summaryrefslogtreecommitdiffstats
path: root/tests/result.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/result.test')
-rw-r--r--tests/result.test32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/result.test b/tests/result.test
index cefcaed..9e8a66b 100644
--- a/tests/result.test
+++ b/tests/result.test
@@ -9,13 +9,12 @@
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# SCCS: @(#) result.test 1.4 97/12/08 15:07:49
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
- namespace import -force ::tcltest::*
-}
+package require tcltest 2
+namespace import ::tcltest::*
+
+::tcltest::loadTestedCommands
+catch [list package require -exact Tcltest [info patchlevel]]
# Some tests require the testsaveresult command
@@ -49,7 +48,6 @@ test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult object {set x 42} 1
} {42 different}
-
# Tcl_RestoreInterpResult is mostly tested by the previous tests except
# for the following case
@@ -60,9 +58,9 @@ test result-2.1 {Tcl_RestoreInterpResult} {testsaveresult} {
# Tcl_DiscardInterpResult is mostly tested by the previous tests except
# for the following cases
-test result-3.1 {Tcl_DiscardInterpResult} {testsaveresult} {
- list [catch {testsaveresult append {cd _foobar} 1} msg] $msg
-} {1 {couldn't change working directory to "_foobar": no such file or directory}}
+test result-3.1 {Tcl_DiscardInterpResult} -constraints testsaveresult -body {
+ testsaveresult append {cd _foobar} 1
+} -returnCodes error -result {couldn't change working directory to "_foobar": no such file or directory}
test result-3.2 {Tcl_DiscardInterpResult} {testsaveresult} {
testsaveresult free {set x 42} 1
} {42}
@@ -132,8 +130,18 @@ test result-6.2 {Bug 1649062} -setup {
} -cleanup {
rename foo {}
} -result {foo {} {}}
-
-
+test result-6.3 {Bug 2383005} {
+ catch {return -code error -errorcode {{}a} eek} m
+ set m
+} {bad -errorcode value: expected a list but got "{}a"}
+test result-6.4 {non-list -errorstack} -body {
+ catch {return -code error -errorstack {{}a} eek} m o
+ list $m [dict get $o -errorcode] [dict get $o -errorstack]
+} -match glob -result {{bad -errorstack value: expected a list but got "{}a"} {TCL RESULT NONLIST_ERRORSTACK} {INNER * UP 1}}
+test result-6.5 {odd-sized-list -errorstack} -body {
+ catch {return -code error -errorstack a eek} m o
+ list $m [dict get $o -errorcode] [dict get $o -errorstack]
+} -match glob -result {{forbidden odd-sized list for -errorstack: "a"} {TCL RESULT ODDSIZEDLIST_ERRORSTACK} {INNER * UP 1}}
# cleanup
cleanupTests
return