os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/while-old.test
First public contribution.
1 # Commands covered: while
3 # This file contains the original set of tests for Tcl's while command.
4 # Since the while command is now compiled, a new set of tests covering
5 # the new implementation is in the file "while.test". Sourcing this file
6 # into Tcl runs the tests and generates output for errors.
7 # No output means no errors were found.
9 # Copyright (c) 1991-1993 The Regents of the University of California.
10 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
11 # Copyright (c) 1998-1999 by Scriptics Corporation.
13 # See the file "license.terms" for information on usage and redistribution
14 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 # RCS: @(#) $Id: while-old.test,v 1.6 2000/04/10 17:19:06 ericm Exp $
18 if {[lsearch [namespace children] ::tcltest] == -1} {
19 package require tcltest
20 namespace import -force ::tcltest::*
23 test while-old-1.1 {basic while loops} {
25 while {$count < 10} {set count [expr $count+1]}
28 test while-old-1.2 {basic while loops} {
30 while {2 > 3} {set value yyy}
33 test while-old-1.3 {basic while loops} {
43 test while-old-1.4 {basic while loops, multiline test expr} {
45 while {($tcl_platform(platform) != "foobar1") && \
46 ($tcl_platform(platform) != "foobar2")} {
52 test while-old-1.5 {basic while loops, test expr in quotes} {
54 while "0 < 3" {set value 2; break}
58 test while-old-2.1 {continue in while loop} {
63 if {$index == 2} {set index [expr $index+1]; continue}
64 set result [concat $result [lindex $list $index]]
65 set index [expr $index+1]
70 test while-old-3.1 {break in while loop} {
75 if {$index == 3} break
76 set result [concat $result [lindex $list $index]]
77 set index [expr $index+1]
82 test while-old-4.1 {errors in while loops} {
83 set err [catch {while} msg]
85 } {1 {wrong # args: should be "while test command"}}
86 test while-old-4.2 {errors in while loops} {
87 set err [catch {while 1} msg]
89 } {1 {wrong # args: should be "while test command"}}
90 test while-old-4.3 {errors in while loops} {
91 set err [catch {while 1 2 3} msg]
93 } {1 {wrong # args: should be "while test command"}}
94 test while-old-4.4 {errors in while loops} {
95 set err [catch {while {"a"+"b"} {error "loop aborted"}} msg]
97 } {1 {can't use non-numeric string as operand of "+"}}
98 test while-old-4.5 {errors in while loops} {
101 set err [catch {while {$x} {set x foo}} msg]
103 } {1 {expected boolean value but got "foo"}}
104 test while-old-4.6 {errors in while loops} {
105 set err [catch {while {1} {error "loop aborted"}} msg]
106 list $err $msg $errorInfo
107 } {1 {loop aborted} {loop aborted
109 "error "loop aborted""}}
111 test while-old-5.1 {while return result} {
112 while {0} {set a 400}
114 test while-old-5.2 {while return result} {
120 ::tcltest::cleanupTests