diff options
Diffstat (limited to 'tests/incr-old.test')
-rw-r--r-- | tests/incr-old.test | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/incr-old.test b/tests/incr-old.test index 7068254..ed457cf 100644 --- a/tests/incr-old.test +++ b/tests/incr-old.test @@ -14,7 +14,7 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest + package require tcltest 2 namespace import -force ::tcltest::* } @@ -45,31 +45,29 @@ test incr-old-2.2 {incr errors} { } {1 {wrong # args: should be "incr varName ?increment?"}} test incr-old-2.3 {incr errors} { catch {unset x} - list [catch {incr x} msg] $msg $errorInfo -} {1 {can't read "x": no such variable} {can't read "x": no such variable - (reading value of variable to increment) - invoked from within -"incr x"}} + incr x +} 1 test incr-old-2.4 {incr errors} { set x abc - list [catch {incr x} msg] $msg $errorInfo + list [catch {incr x} msg] $msg $::errorInfo } {1 {expected integer but got "abc"} {expected integer but got "abc" while executing "incr x"}} test incr-old-2.5 {incr errors} { set x 123 - list [catch {incr x 1a} msg] $msg $errorInfo + list [catch {incr x 1a} msg] $msg $::errorInfo } {1 {expected integer but got "1a"} {expected integer but got "1a" (reading increment) invoked from within "incr x 1a"}} -test incr-old-2.6 {incr errors} { +test incr-old-2.6 {incr errors} -body { proc readonly args {error "variable is read-only"} set x 123 trace var x w readonly - list [catch {incr x 1} msg] $msg $errorInfo -} {1 {can't set "x": variable is read-only} {can't set "x": variable is read-only + list [catch {incr x 1} msg] $msg $::errorInfo +} -match glob -result {1 {can't set "x": variable is read-only} {*variable is read-only while executing +* "incr x 1"}} catch {unset x} test incr-old-2.7 {incr errors} { |