summaryrefslogtreecommitdiffstats
path: root/tests/cmdMZ.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cmdMZ.test')
-rw-r--r--tests/cmdMZ.test76
1 files changed, 37 insertions, 39 deletions
diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test
index ae96301..2d68138 100644
--- a/tests/cmdMZ.test
+++ b/tests/cmdMZ.test
@@ -10,8 +10,6 @@
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: cmdMZ.test,v 1.26 2008/09/10 13:50:05 dkf Exp $
if {[catch {package require tcltest 2.1}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
@@ -38,7 +36,7 @@ namespace eval ::tcl::test::cmdMZ {
return 1
}
customMatch listGlob [namespace which ListGlobMatch]
-
+
# Tcl_PwdObjCmd
test cmdMZ-1.1 {Tcl_PwdObjCmd} -returnCodes error -body {
@@ -96,11 +94,11 @@ test cmdMZ-return-1.0 {return checks for bad option values} -body {
return -options foo
} -returnCodes error -match glob -result {bad -options value:*}
test cmdMZ-return-1.1 {return checks for bad option values} -body {
- return -code foo
-} -returnCodes error -match glob -result {bad completion code*}
+ return -code err
+} -returnCodes error -match glob -result {bad completion code "err": must be ok, error, return, break, continue*, or an integer}
test cmdMZ-return-1.2 {return checks for bad option values} -body {
return -code 0x100000000
-} -returnCodes error -match glob -result {bad completion code*}
+} -returnCodes error -match glob -result {bad completion code "0x100000000": must be ok, error, return, break, continue*, or an integer}
test cmdMZ-return-1.3 {return checks for bad option values} -body {
return -level foo
} -returnCodes error -match glob -result {bad -level value: *}
@@ -149,11 +147,11 @@ test cmdMZ-return-2.8 {return option handling} -body {
test cmdMZ-return-2.9 {return option handling} -body {
return -level 0 -code 10
} -returnCodes 10 -result {}
-test cmdMZ-return-2.10 {return option handling} {
+test cmdMZ-return-2.10 {return option handling} -body {
list [catch {return -level 0 -code error} -> foo] [dictSort $foo]
-} {1 {-code 1 -errorcode NONE -errorinfo {
+} -match glob -result {1 {-code 1 -errorcode NONE -errorinfo {
while executing
-"return -level 0 -code error"} -errorline 1 -level 0}}
+"return -level 0 -code error"} -errorline 1 -errorstack * -level 0}}
test cmdMZ-return-2.11 {return option handling} {
list [catch {return -level 0 -code break} -> foo] [dictSort $foo]
} {3 {-code 3 -level 0}}
@@ -161,38 +159,37 @@ test cmdMZ-return-2.12 {return option handling} -body {
return -level 0 -code error -options {-code ok}
} -returnCodes ok -result {}
test cmdMZ-return-2.13 {return option handling} -body {
- return -level 0 -code error -options {-code foo}
-} -returnCodes error -match glob -result {bad completion code*}
+ return -level 0 -code error -options {-code err}
+} -returnCodes error -match glob -result {bad completion code "err": must be ok, error, return, break, continue*, or an integer}
test cmdMZ-return-2.14 {return option handling} -body {
return -level 0 -code error -options {-code foo -options {-code break}}
} -returnCodes break -result {}
-test cmdMZ-return-2.15 {return opton handling} -setup {
- proc p {} {
- return -code error -errorcode {a b} c
- }
-} -body {
- list [catch p result] $result $::errorCode
-} -cleanup {
- rename p {}
-} -result {1 c {a b}}
-test cmdMZ-return-2.16 {return opton handling} -setup {
- proc p {} {
- return -code error -errorcode [list a b] c
- }
-} -body {
- list [catch p result] $result $::errorCode
-} -cleanup {
- rename p {}
-} -result {1 c {a b}}
-test cmdMZ-return-2.17 {return opton handling} -setup {
- proc p {} {
- return -code error -errorcode a\ b c
- }
-} -body {
- list [catch p result] $result $::errorCode
-} -cleanup {
- rename p {}
-} -result {1 c {a b}}
+test cmdMZ-return-2.15 {return opton handling} {
+ list [catch {
+ apply {{} {
+ return -code error -errorcode {a b} c
+ }}
+ } result] $result $::errorCode
+} {1 c {a b}}
+test cmdMZ-return-2.16 {return opton handling} {
+ list [catch {
+ apply {{} {
+ return -code error -errorcode [list a b] c
+ }}
+ } result] $result $::errorCode
+} {1 c {a b}}
+test cmdMZ-return-2.17 {return opton handling} {
+ list [catch {
+ apply {{} {
+ return -code error -errorcode a\ b c
+ }}
+ } result] $result $::errorCode
+} {1 c {a b}}
+test cmdMZ-return-2.18 {return option handling} {
+ list [catch {
+ return -code error -errorstack [list CALL a CALL b] yo
+ } -> foo] [dictSort $foo] [info errorstack]
+} {2 {-code 1 -errorcode NONE -errorstack {CALL a CALL b} -level 1} {CALL a CALL b}}
# Check that the result of a [return -options $opts $result] is
# indistinguishable from that of the originally caught script, no matter what
@@ -211,6 +208,7 @@ foreach {testid script} {
cmdMZ-return-3.10 {return -code error -errorinfo foo}
cmdMZ-return-3.11 {return -code error -errorinfo foo -errorcode bar}
cmdMZ-return-3.12 {return -code error -errorinfo foo -errorcode bar -errorline 10}
+ cmdMZ-return-3.12.1 {return -code error -errorinfo foo -errorcode bar -errorline 10 -errorstack baz}
cmdMZ-return-3.13 {return -options {x y z 2}}
cmdMZ-return-3.14 {return -level 3 -code break sdf}
} {
@@ -345,7 +343,7 @@ test cmdMZ-5.7 {Tcl_TimeObjCmd: errors generate right trace} {
"time {error foo}"}}
# The tests for Tcl_WhileObjCmd are in while.test
-
+
# cleanup
cleanupTests
}