diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-01-24 11:49:28 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-15 11:02:42 +1000 |
commit | b367df9ca11f36a392b97afc2767694f8bfe1c4f (patch) | |
tree | b61a231c02622789cadaee3f3ed7c824d2a221d1 /tests/for.test | |
parent | fb44f9ee2d4b23bc4f5f46ad3b01b33e563932cd (diff) | |
download | jimtcl-b367df9ca11f36a392b97afc2767694f8bfe1c4f.zip jimtcl-b367df9ca11f36a392b97afc2767694f8bfe1c4f.tar.gz jimtcl-b367df9ca11f36a392b97afc2767694f8bfe1c4f.tar.bz2 |
Bugs, features, tests
Subst was broken for backslash escapes
Add support for return, break, continue in subst commands
Accept abbreviations for switches to subst
Fix 'list #'
More tests
Diffstat (limited to 'tests/for.test')
-rw-r--r-- | tests/for.test | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/for.test b/tests/for.test new file mode 100644 index 0000000..d3a136e --- /dev/null +++ b/tests/for.test @@ -0,0 +1,66 @@ +# Commands covered: for, continue, break +# +# This file contains the original set of tests for Tcl's for command. +# Since the for command is now compiled, a new set of tests covering +# the new implementation is in the file "for.test". Sourcing this file +# into Tcl runs the tests and generates output for errors. +# No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994-1996 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: for-old.test,v 1.5 2000/04/10 17:18:59 ericm Exp $ + +source testing.tcl + +# Check "for" and its use of continue and break. + +catch {unset a i} +test for-old-1.1 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + set a [concat $a $i] + } + set a +} {1 2 3 4 5} +test for-old-1.2 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + if $i==4 continue + set a [concat $a $i] + } + set a +} {1 2 3 5} +test for-old-1.3 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + if $i==4 break + set a [concat $a $i] + } + set a +} {1 2 3} +test for-old-1.4 {for tests} {catch {for 1 2 3} msg} 1 +test for-old-1.5 {for tests} { + catch {for 1 2 3} msg +} {1} +test for-old-1.6 {for tests} {catch {for 1 2 3 4 5} msg} 1 +test for-old-1.7 {for tests} { + catch {for 1 2 3 4 5} msg +} {1} +test for-old-1.8 {for tests} { + set a {xyz} + for {set i 1} {$i<6} {set i [expr $i+1]} {} + set a +} xyz +test for-old-1.9 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]; if $i==4 break} { + set a [concat $a $i] + } + set a +} {1 2 3} + +testreport |