diff options
Diffstat (limited to 'tests/while-old.test')
| -rw-r--r-- | tests/while-old.test | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/while-old.test b/tests/while-old.test index b5b69dc..ee17d0b 100644 --- a/tests/while-old.test +++ b/tests/while-old.test @@ -6,21 +6,21 @@ # into Tcl runs the tests and generates output for errors. # No output means no errors were found. # -# Copyright © 1991-1993 The Regents of the University of California. -# Copyright © 1994-1996 Sun Microsystems, Inc. -# Copyright © 1998-1999 Scriptics Corporation. +# 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. -if {"::tcltest" ni [namespace children]} { - package require tcltest 2.5 +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest namespace import -force ::tcltest::* } test while-old-1.1 {basic while loops} { set count 0 - while {$count < 10} {set count [expr {$count + 1}]} + while {$count < 10} {set count [expr $count+1]} set count } 10 test while-old-1.2 {basic while loops} { @@ -58,9 +58,9 @@ test while-old-2.1 {continue in while loop} { set index 0 set result {} while {$index < 5} { - if {$index == 2} {set index [expr {$index + 1}]; continue} + if {$index == 2} {set index [expr $index+1]; continue} set result [concat $result [lindex $list $index]] - set index [expr {$index + 1}] + set index [expr $index+1] } set result } {1 2 4 5} @@ -72,7 +72,7 @@ test while-old-3.1 {break in while loop} { while {$index < 5} { if {$index == 3} break set result [concat $result [lindex $list $index]] - set index [expr {$index + 1}] + set index [expr $index+1] } set result } {1 2 3} @@ -92,7 +92,7 @@ test while-old-4.3 {errors in while loops} { test while-old-4.4 {errors in while loops} { set err [catch {while {"a"+"b"} {error "loop aborted"}} msg] list $err $msg -} {1 {can't use non-numeric string "a" as operand of "+"}} +} {1 {can't use non-numeric string as operand of "+"}} test while-old-4.5 {errors in while loops} { catch {unset x} set x 1 |
