diff options
Diffstat (limited to 'tests/incr-old.test')
| -rw-r--r-- | tests/incr-old.test | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/incr-old.test b/tests/incr-old.test index 8fbd89f..ed457cf 100644 --- a/tests/incr-old.test +++ b/tests/incr-old.test @@ -8,13 +8,15 @@ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# SCCS: @(#) incr-old.test 1.11 96/11/19 16:56:23 -if {[string compare test [info procs test]] == 1} then {source defs} +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import -force ::tcltest::* +} catch {unset x} @@ -30,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} @@ -43,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} { @@ -86,4 +87,6 @@ test incr-old-2.10 {incr errors} { list [catch {incr x 1} msg] $msg } {1 {expected integer but got "20 x"}} -concat {} +# cleanup +::tcltest::cleanupTests +return |
