summaryrefslogtreecommitdiffstats
path: root/tests/result.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/result.test')
-rw-r--r--tests/result.test43
1 files changed, 21 insertions, 22 deletions
diff --git a/tests/result.test b/tests/result.test
index 0e61575..3ee803e 100644
--- a/tests/result.test
+++ b/tests/result.test
@@ -17,8 +17,10 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
# Some tests require the testsaveresult command
-::tcltest::testConstraint testsaveresult \
- [expr {[info commands testsaveresult] != {}}]
+testConstraint testsaveresult [llength [info commands testsaveresult]]
+testConstraint testsetobjerrorcode [llength [info commands testsetobjerrorcode]]
+testConstraint testseterrorcode [llength [info commands testseterrorcode]]
+testConstraint testreturn [llength [info commands testreturn]]
test result-1.1 {Tcl_SaveInterpResult} {testsaveresult} {
testsaveresult small {set x 42} 0
@@ -63,9 +65,6 @@ test result-3.2 {Tcl_DiscardInterpResult} {testsaveresult} {
testsaveresult free {set x 42} 1
} {42}
-::tcltest::testConstraint testsetobjerrorcode \
- [expr {[info commands testsetobjerrorcode] != {}}]
-
test result-4.1 {Tcl_SetObjErrorCode - one arg} {testsetobjerrorcode} {
catch {testsetobjerrorcode 1}
list [set errorCode]
@@ -87,9 +86,6 @@ test result-4.5 {Tcl_SetObjErrorCode - five args} {testsetobjerrorcode} {
list [set errorCode]
} {{1 2 3 4 5}}
-::tcltest::testConstraint testseterrorcode \
- [expr {[info commands testseterrorcode] != {}}]
-
test result-5.1 {Tcl_SetErrorCode - one arg} testseterrorcode {
catch {testseterrorcode 1}
set errorCode
@@ -107,6 +103,18 @@ test result-5.4 {Tcl_SetErrorCode - two args, list quoting} testseterrorcode {
set errorCode
} {{a b} c}
+test result-6.0 {Bug 1209759} -constraints testreturn -body {
+ # Might panic if bug is not fixed.
+ proc foo {} {testreturn}
+ foo
+} -returnCodes ok -result {}
+test result-6.1 {Bug 1209759} -constraints testreturn -body {
+ # Might panic if bug is not fixed.
+ proc foo {} {catch {return -level 2}; testreturn}
+ foo
+} -cleanup {
+ rename foo {}
+} -returnCodes ok -result {}
test result-6.2 {Bug 1649062} -setup {
proc foo {} {
if {[catch {
@@ -122,19 +130,10 @@ 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"}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-