diff options
Diffstat (limited to 'tests/incr-old.test')
| -rw-r--r-- | tests/incr-old.test | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/tests/incr-old.test b/tests/incr-old.test index 0344c42..ed457cf 100644 --- a/tests/incr-old.test +++ b/tests/incr-old.test @@ -12,11 +12,9 @@ # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# RCS: @(#) $Id: incr-old.test,v 1.5 2000/04/10 17:19:00 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest + package require tcltest 2 namespace import -force ::tcltest::* } @@ -34,7 +32,7 @@ test incr-old-1.3 {basic incr operation} { set x " -106" list [incr x 1] $x } {-105 -105} -test incr-old-1.3 {basic incr operation} { +test incr-old-1.4 {basic incr operation} { set x " +106" list [incr x 1] $x } {107 107} @@ -47,30 +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" - while executing + (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} { @@ -93,15 +90,3 @@ test incr-old-2.10 {incr errors} { # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - |
