summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cmdMZ.test28
-rw-r--r--tests/encoding.test5
-rw-r--r--tests/error.test24
-rw-r--r--tests/execute.test6
-rw-r--r--tests/info.test10
-rw-r--r--tests/init.test4
6 files changed, 50 insertions, 27 deletions
diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test
index ae96301..8ae7a3a 100644
--- a/tests/cmdMZ.test
+++ b/tests/cmdMZ.test
@@ -11,7 +11,7 @@
# 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 $
+# RCS: @(#) $Id: cmdMZ.test,v 1.27 2009/11/16 17:38:09 ferrieux Exp $
if {[catch {package require tcltest 2.1}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
@@ -119,18 +119,18 @@ proc dictSort {d} {
return $result
}
-test cmdMZ-return-2.0 {return option handling} {
+test cmdMZ-return-2.0 {return option handling} -body {
list [catch return -> foo] [dictSort $foo]
-} {2 {-code 0 -level 1}}
-test cmdMZ-return-2.1 {return option handling} {
+} -match glob -result {2 {-code 0 -errorstack * -level 1}}
+test cmdMZ-return-2.1 {return option handling} -body {
list [catch {return -bar soom} -> foo] [dictSort $foo]
-} {2 {-bar soom -code 0 -level 1}}
-test cmdMZ-return-2.2 {return option handling} {
+} -match glob -result {2 {-bar soom -code 0 -errorstack * -level 1}}
+test cmdMZ-return-2.2 {return option handling} -body {
list [catch {return -code return} -> foo] [dictSort $foo]
-} {2 {-code 0 -level 2}}
-test cmdMZ-return-2.3 {return option handling} {
+} -match glob -result {2 {-code 0 -errorstack * -level 2}}
+test cmdMZ-return-2.3 {return option handling} -body {
list [catch {return -code return -level 10} -> foo] [dictSort $foo]
-} {2 {-code 0 -level 11}}
+} -match glob -result {2 {-code 0 -errorstack * -level 11}}
test cmdMZ-return-2.4 {return option handling} -body {
return -level 0 -code error
} -returnCodes error -result {}
@@ -149,14 +149,14 @@ 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}}
-test cmdMZ-return-2.11 {return option handling} {
+"return -level 0 -code error"} -errorline 1 -errorstack * -level 0}}
+test cmdMZ-return-2.11 {return option handling} -body {
list [catch {return -level 0 -code break} -> foo] [dictSort $foo]
-} {3 {-code 3 -level 0}}
+} -match glob -result {3 {-code 3 -errorstack * -level 0}}
test cmdMZ-return-2.12 {return option handling} -body {
return -level 0 -code error -options {-code ok}
} -returnCodes ok -result {}
diff --git a/tests/encoding.test b/tests/encoding.test
index 0aa49d3..bc57b2d 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: encoding.test,v 1.28 2008/06/20 16:18:13 dgp Exp $
+# RCS: @(#) $Id: encoding.test,v 1.29 2009/11/16 17:38:09 ferrieux Exp $
package require tcltest 2
@@ -414,9 +414,10 @@ test encoding-24.2 {EscapeFreeProc on open channels} -constraints {
} -setup {
# Bug #524674 output
set file [makeFile {
+ encoding system cp1252; # Bug #2891556 crash revelator
fconfigure stdout -encoding iso2022-jp
puts ab\u4e4e\u68d9g
- exit
+ testfinexit
} iso2022.tcl]
} -body {
viewable [exec [interpreter] $file]
diff --git a/tests/error.test b/tests/error.test
index e18afad..1b0f0fa 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: error.test,v 1.22 2009/09/28 18:02:20 dgp Exp $
+# RCS: @(#) $Id: error.test,v 1.23 2009/11/16 17:38:09 ferrieux Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -153,6 +153,19 @@ test error-4.5 {errorInfo and errorCode variables} {
list [catch {error msg1 msg2 {}} msg] $msg $::errorInfo $::errorCode
} {1 msg1 msg2 {}}
+test error-4.6 {errorstack via info } -body {
+ proc f x {g $x$x}
+ proc g x {error G:$x}
+ catch {f 12}
+ info errorstack
+} -match glob -result {{g 1212} {f 12} {namespace eval *}}
+test error-4.7 {errorstack via options dict } -body {
+ proc f x {g $x$x}
+ proc g x {error G:$x}
+ catch {f 12} m d
+ dict get $d -errorstack
+} -match glob -result {{g 1212} {f 12} {namespace eval *}}
+
# Errors in error command itself
test error-5.1 {errors in error command} {
@@ -207,6 +220,15 @@ test error-6.9 {catch must reset error state} {
catch foo
list $::errorCode
} {NONE}
+test error-6.10 {catch must reset errorstack} -body {
+ proc f x {g $x$x}
+ proc g x {error G:$x}
+ catch {f 12}
+ set e1 [info errorstack]
+ catch {f 13}
+ set e2 [info errorstack]
+ list $e1 $e2
+} -match glob -result {{{g 1212} {f 12} {namespace eval *}} {{g 1313} {f 13} {namespace eval *}}}
test error-7.1 {Bug 1397843} -body {
variable cmds
diff --git a/tests/execute.test b/tests/execute.test
index b277da8..aa9e943 100644
--- a/tests/execute.test
+++ b/tests/execute.test
@@ -14,7 +14,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: execute.test,v 1.32 2009/06/24 13:51:36 dgp Exp $
+# RCS: @(#) $Id: execute.test,v 1.33 2009/11/16 17:38:09 ferrieux Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -956,11 +956,11 @@ test execute-8.5 {Bug 2038069} -setup {
demo
} -cleanup {
rename demo {}
-} -result {-code 1 -level 0 -errorcode NONE -errorinfo {FOO
+} -match glob -result {-code 1 -level 0 -errorcode NONE -errorinfo {FOO
while executing
"error FOO"
invoked from within
-"catch [list error FOO] m o"} -errorline 2}
+"catch \[list error FOO\] m o"} -errorline 2 -errorstack *}
test execute-9.1 {Interp result resetting [Bug 1522803]} {
set c 0
diff --git a/tests/info.test b/tests/info.test
index 21b7712..aa4a29f 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: info.test,v 1.71 2009/11/10 17:57:39 andreas_kupries Exp $
+# RCS: @(#) $Id: info.test,v 1.72 2009/11/16 17:38:09 ferrieux Exp $
if {{::tcltest} ni [namespace children]} {
package require tcltest 2
@@ -676,16 +676,16 @@ test info-21.1 {miscellaneous error conditions} -returnCodes error -body {
} -result {wrong # args: should be "info subcommand ?arg ...?"}
test info-21.2 {miscellaneous error conditions} -returnCodes error -body {
info gorp
-} -result {unknown or ambiguous subcommand "gorp": must be args, body, class, cmdcount, commands, complete, coroutine, default, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
+} -result {unknown or ambiguous subcommand "gorp": must be args, body, class, cmdcount, commands, complete, coroutine, default, errorstack, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
test info-21.3 {miscellaneous error conditions} -returnCodes error -body {
info c
-} -result {unknown or ambiguous subcommand "c": must be args, body, class, cmdcount, commands, complete, coroutine, default, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
+} -result {unknown or ambiguous subcommand "c": must be args, body, class, cmdcount, commands, complete, coroutine, default, errorstack, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
test info-21.4 {miscellaneous error conditions} -returnCodes error -body {
info l
-} -result {unknown or ambiguous subcommand "l": must be args, body, class, cmdcount, commands, complete, coroutine, default, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
+} -result {unknown or ambiguous subcommand "l": must be args, body, class, cmdcount, commands, complete, coroutine, default, errorstack, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
test info-21.5 {miscellaneous error conditions} -returnCodes error -body {
info s
-} -result {unknown or ambiguous subcommand "s": must be args, body, class, cmdcount, commands, complete, coroutine, default, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
+} -result {unknown or ambiguous subcommand "s": must be args, body, class, cmdcount, commands, complete, coroutine, default, errorstack, exists, frame, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, object, patchlevel, procs, script, sharedlibextension, tclversion, or vars}
##
# ### ### ### ######### ######### #########
diff --git a/tests/init.test b/tests/init.test
index 41b8382..b5eba4c 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: init.test,v 1.19 2009/07/25 22:00:10 dkf Exp $
+# RCS: @(#) $Id: init.test,v 1.20 2009/11/16 17:38:09 ferrieux Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -181,7 +181,7 @@ test init-5.0 {return options passed through ::unknown} -setup {
list $code $foo $bar $code2 $foo2 $bar2
} -cleanup {
unset ::auto_index(::xxx)
-} -result {2 xxx {-errorcode NONE -code 1 -level 1} 2 xxx {-code 1 -level 1 -errorcode NONE}}
+} -match glob -result {2 xxx {-errorcode NONE -errorstack * -code 1 -level 1} 2 xxx {-code 1 -level 1 -errorcode NONE -errorstack *}}
cleanupTests
} ;# End of [interp eval $testInterp]