summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compExpr-old.test92
-rw-r--r--tests/compExpr.test10
-rw-r--r--tests/expr.test90
-rw-r--r--tests/for.test58
-rw-r--r--tests/if.test52
-rw-r--r--tests/incr.test44
-rw-r--r--tests/while.test28
7 files changed, 170 insertions, 204 deletions
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index b3e0677..8ce962d 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -12,10 +12,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compExpr-old.test,v 1.9 2004/05/19 20:15:31 dkf Exp $
+# RCS: @(#) $Id: compExpr-old.test,v 1.10 2004/09/26 16:36:05 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
@@ -479,11 +479,11 @@ test compExpr-old-14.15 {CompilePrimaryExpr: var reference primary} {
catch {expr $i.2} msg
set msg
} 123.2
-test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} {
+test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} -body {
catch {expr {$a(foo}} msg
set errorInfo
-} {missing )
- while compiling
+} -match glob -result {missing )
+ while *ing
"expr {$a(foo}"}
test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {
expr $
@@ -508,95 +508,91 @@ test compExpr-old-14.21 {CompilePrimaryExpr: error in quoted string primary} {
test compExpr-old-14.22 {CompilePrimaryExpr: subcommand primary} {
expr {[set i 123; set i]}
} 123
-test compExpr-old-14.23 {CompilePrimaryExpr: error in subcommand primary} {
+test compExpr-old-14.23 {CompilePrimaryExpr: error in subcommand primary} -body {
catch {expr {[set]}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"expr {[set]}"}
-test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} {
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
+test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} -body {
catch {expr {[set i}} msg
set errorInfo
-} {missing close-bracket
- while compiling
-"expr {[set i}"}
+} -match glob -result {missing close-bracket
+ while *ing
+"expr {\[set i}"}
test compExpr-old-14.25 {CompilePrimaryExpr: math function primary} {
format %.6g [expr exp(1.0)]
} 2.71828
test compExpr-old-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
-test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} {
+test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
-} {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments
- while compiling
+} -match glob -result {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments
+ while *ing
"expr sinh::(2.0)"}
test compExpr-old-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
-test compExpr-old-14.29 {CompilePrimaryExpr: error in subexpression primary} {
+test compExpr-old-14.29 {CompilePrimaryExpr: error in subexpression primary} -body {
catch {expr 2+(3*[set])} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"expr 2+(3*[set])"}
-test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} {
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
+test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -body {
catch {expr 2+(3*(4+5)} msg
set errorInfo
-} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
- while compiling
+} -match glob -result {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
+ while *ing
"expr 2+(3*(4+5)"}
test compExpr-old-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
set i "5+10"
list "[expr $i] == 15" "[expr ($i)] == 15" "[eval expr ($i)] == 15"
} {{15 == 15} {15 == 15} {15 == 15}}
-test compExpr-old-14.32 {CompilePrimaryExpr: unexpected token} {
+test compExpr-old-14.32 {CompilePrimaryExpr: unexpected token} -body {
catch {expr @} msg
set errorInfo
-} {syntax error in expression "@": character not legal in expressions
- while compiling
+} -match glob -result {syntax error in expression "@": character not legal in expressions
+ while *ing
"expr @"}
-test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} {
+test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
-} {syntax error in expression "sinh2.0)": variable references require preceding $
- while compiling
+} -match glob -result {syntax error in expression "sinh2.0)": variable references require preceding $
+ while *ing
"expr sinh2.0)"}
-test compExpr-old-15.2 {CompileMathFuncCall: unknown math function} {
+test compExpr-old-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
-} {unknown math function "whazzathuh"
- while compiling
+} -match glob -result {unknown math function "whazzathuh"
+ while *ing
"expr whazzathuh(1)"}
-test compExpr-old-15.3 {CompileMathFuncCall: too many arguments} {
+test compExpr-old-15.3 {CompileMathFuncCall: too many arguments} -body {
catch {expr sin(1,2,3)} msg
set errorInfo
-} {too many arguments for math function
- while compiling
+} -match glob -result {too many arguments for math function
+ while *ing
"expr sin(1,2,3)"}
-test compExpr-old-15.4 {CompileMathFuncCall: ')' found before last required arg} {
+test compExpr-old-15.4 {CompileMathFuncCall: ')' found before last required arg} -body {
catch {expr sin()} msg
set errorInfo
-} {too few arguments for math function
- while compiling
+} -match glob -result {too few arguments for math function
+ while *ing
"expr sin()"}
-test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} {
+test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} -body {
catch {expr pow(1)} msg
set errorInfo
-} {too few arguments for math function
- while compiling
+} -match glob -result {too few arguments for math function
+ while *ing
"expr pow(1)"}
-test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} {
+test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body {
catch {expr sin(1} msg
set errorInfo
-} {syntax error in expression "sin(1": missing close parenthesis at end of function call
- while compiling
+} -match glob -result {syntax error in expression "sin(1": missing close parenthesis at end of function call
+ while *ing
"expr sin(1"}
test compExpr-old-15.7 {CompileMathFuncCall: call registered math function} testmathfunctions {
expr 2*T1()
diff --git a/tests/compExpr.test b/tests/compExpr.test
index 4470fef..eec796e 100644
--- a/tests/compExpr.test
+++ b/tests/compExpr.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compExpr.test,v 1.7 2004/05/19 20:15:31 dkf Exp $
+# RCS: @(#) $Id: compExpr.test,v 1.8 2004/09/26 16:36:05 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -87,7 +87,7 @@ test compExpr-2.13 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse
catch {unset a}
set a 15
list [catch {expr {27 || "$a[expr 1+]00"}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+} {0 1}
test compExpr-2.14 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, op found} {
expr {5*6}
} 30
@@ -180,7 +180,7 @@ test compExpr-2.42 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse
catch {unset a}
set a 15
list [catch {expr {27 || "$a[expr 1+]00"}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+} {0 1}
test compExpr-2.43 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} {
catch {unset a}
set a false
@@ -195,7 +195,7 @@ test compExpr-2.45 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse
catch {unset a}
set a 15
list [catch {expr {1? 54 : "$a[expr 1+]00"}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+} {0 54}
test compExpr-3.1 {CompileLandOrLorExpr procedure, numeric 1st operand} {
catch {unset a}
@@ -284,7 +284,7 @@ test compExpr-4.8 {CompileCondExpr procedure, convert "false" clause to numeric}
} 83
test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} {
list [catch {expr {1? 15 : [expr *2]}} msg] $msg
-} {1 {syntax error in expression "*2": unexpected operator *}}
+} {0 15}
test compExpr-5.1 {CompileMathFuncCall procedure, math function found} {
format %.6g [expr atan2(1.0, 2.0)]
diff --git a/tests/expr.test b/tests/expr.test
index 4c3279d..4cfa615 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr.test,v 1.26 2004/09/24 21:30:11 dkf Exp $
+# RCS: @(#) $Id: expr.test,v 1.27 2004/09/26 16:36:05 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -507,11 +507,11 @@ test expr-14.15 {CompilePrimaryExpr: var reference primary} {
catch {expr $i.2} msg
set msg
} 123.2
-test expr-14.16 {CompilePrimaryExpr: error compiling var reference primary} {
+test expr-14.16 {CompilePrimaryExpr: error compiling var reference primary} -body {
catch {expr {$a(foo}} msg
set errorInfo
-} {missing )
- while compiling
+} -match glob -result {missing )
+ while *ing
"expr {$a(foo}"}
test expr-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {
expr $
@@ -536,95 +536,91 @@ test expr-14.21 {CompilePrimaryExpr: error in quoted string primary} {
test expr-14.22 {CompilePrimaryExpr: subcommand primary} {
expr {[set i 123; set i]}
} 123
-test expr-14.23 {CompilePrimaryExpr: error in subcommand primary} {
+test expr-14.23 {CompilePrimaryExpr: error in subcommand primary} -body {
catch {expr {[set]}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"expr {[set]}"}
-test expr-14.24 {CompilePrimaryExpr: error in subcommand primary} {
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
+test expr-14.24 {CompilePrimaryExpr: error in subcommand primary} -body {
catch {expr {[set i}} msg
set errorInfo
-} {missing close-bracket
- while compiling
-"expr {[set i}"}
+} -match glob -result {missing close-bracket
+ while *ing
+"expr {\[set i}"}
test expr-14.25 {CompilePrimaryExpr: math function primary} {
format %.6g [expr exp(1.0)]
} 2.71828
test expr-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
-test expr-14.27 {CompilePrimaryExpr: error in math function primary} {
+test expr-14.27 {CompilePrimaryExpr: error in math function primary} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
-} {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments
- while compiling
+} -match glob -result {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments
+ while *ing
"expr sinh::(2.0)"}
test expr-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
-test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} {
+test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} -body {
catch {expr 2+(3*[set])} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"expr 2+(3*[set])"}
-test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} {
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
+test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -body {
catch {expr 2+(3*(4+5)} msg
set errorInfo
-} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
- while compiling
+} -match glob -result {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
+ while *ing
"expr 2+(3*(4+5)"}
test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
set i "5+10"
list "[expr $i] == 15" "[expr ($i)] == 15" "[eval expr ($i)] == 15"
} {{15 == 15} {15 == 15} {15 == 15}}
-test expr-14.32 {CompilePrimaryExpr: unexpected token} {
+test expr-14.32 {CompilePrimaryExpr: unexpected token} -body {
catch {expr @} msg
set errorInfo
-} {syntax error in expression "@": character not legal in expressions
- while compiling
+} -match glob -result {syntax error in expression "@": character not legal in expressions
+ while *ing
"expr @"}
-test expr-15.1 {CompileMathFuncCall: missing parenthesis} {
+test expr-15.1 {CompileMathFuncCall: missing parenthesis} -body {
catch {expr sinh2.0)} msg
set errorInfo
-} {syntax error in expression "sinh2.0)": variable references require preceding $
- while compiling
+} -match glob -result {syntax error in expression "sinh2.0)": variable references require preceding $
+ while *ing
"expr sinh2.0)"}
-test expr-15.2 {CompileMathFuncCall: unknown math function} {
+test expr-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
-} {unknown math function "whazzathuh"
- while compiling
+} -match glob -result {unknown math function "whazzathuh"
+ while *ing
"expr whazzathuh(1)"}
-test expr-15.3 {CompileMathFuncCall: too many arguments} {
+test expr-15.3 {CompileMathFuncCall: too many arguments} -body {
catch {expr sin(1,2,3)} msg
set errorInfo
-} {too many arguments for math function
- while compiling
+} -match glob -result {too many arguments for math function
+ while *ing
"expr sin(1,2,3)"}
-test expr-15.4 {CompileMathFuncCall: ')' found before last required arg} {
+test expr-15.4 {CompileMathFuncCall: ')' found before last required arg} -body {
catch {expr sin()} msg
set errorInfo
-} {too few arguments for math function
- while compiling
+} -match glob -result {too few arguments for math function
+ while *ing
"expr sin()"}
-test expr-15.5 {CompileMathFuncCall: too few arguments} {
+test expr-15.5 {CompileMathFuncCall: too few arguments} -body {
catch {expr pow(1)} msg
set errorInfo
-} {too few arguments for math function
- while compiling
+} -match glob -result {too few arguments for math function
+ while *ing
"expr pow(1)"}
-test expr-15.6 {CompileMathFuncCall: missing ')'} {
+test expr-15.6 {CompileMathFuncCall: missing ')'} -body {
catch {expr sin(1} msg
set errorInfo
-} {syntax error in expression "sin(1": missing close parenthesis at end of function call
- while compiling
+} -match glob -result {syntax error in expression "sin(1": missing close parenthesis at end of function call
+ while *ing
"expr sin(1"}
test expr-15.7 {CompileMathFuncCall: call registered math function} {testmathfunctions} {
expr 2*T1()
diff --git a/tests/for.test b/tests/for.test
index 4fbeef7..c6d7395 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -9,10 +9,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: for.test,v 1.9 2001/12/06 10:59:18 dkf Exp $
+# RCS: @(#) $Id: for.test,v 1.10 2004/09/26 16:36:06 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
@@ -21,21 +21,21 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
test for-1.1 {TclCompileForCmd: missing initial command} {
list [catch {for} msg] $msg
} {1 {wrong # args: should be "for start test next command"}}
-test for-1.2 {TclCompileForCmd: error in initial command} {
+test for-1.2 {TclCompileForCmd: error in initial command} -body {
list [catch {for {set}} msg] $msg $errorInfo
-} {1 {wrong # args: should be "for start test next command"} {wrong # args: should be "for start test next command"
- while compiling
+} -match glob -result {1 {wrong # args: should be "for start test next command"} {wrong # args: should be "for start test next command"
+ while *ing
"for {set}"}}
catch {unset i}
test for-1.3 {TclCompileForCmd: missing test expression} {
catch {for {set i 0}} msg
set msg
} {wrong # args: should be "for start test next command"}
-test for-1.4 {TclCompileForCmd: error in test expression} {
+test for-1.4 {TclCompileForCmd: error in test expression} -body {
catch {for {set i 0} {$i<}} msg
set errorInfo
-} {wrong # args: should be "for start test next command"
- while compiling
+} -match glob -result {wrong # args: should be "for start test next command"
+ while *ing
"for {set i 0} {$i<}"}
test for-1.5 {TclCompileForCmd: test expression is enclosed in quotes} {
set i 0
@@ -49,15 +49,12 @@ test for-1.7 {TclCompileForCmd: missing command body} {
catch {for {set i 0} {$i < 5} {incr i}} msg
set msg
} {wrong # args: should be "for start test next command"}
-test for-1.8 {TclCompileForCmd: error compiling command body} {
+test for-1.8 {TclCompileForCmd: error compiling command body} -body {
catch {for {set i 0} {$i < 5} {incr i} {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- ("for" body line 1)
- while compiling
-"for {set i 0} {$i < 5} {incr i} {set}"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
catch {unset a}
test for-1.9 {TclCompileForCmd: simple command body} {
set a {}
@@ -83,15 +80,12 @@ test for-1.11 {TclCompileForCmd: computed command body} {
for {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
set a
} {x1}
-test for-1.12 {TclCompileForCmd: error in "next" command} {
- catch {for {set i 0} {$i < 5} {set} {puts $i}} msg
+test for-1.12 {TclCompileForCmd: error in "next" command} -body {
+ catch {for {set i 0} {$i < 5} {set} {format $i}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- ("for" loop-end command)
- while compiling
-"for {set i 0} {$i < 5} {set} {puts $i}"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
test for-1.13 {TclCompileForCmd: long command body} {
set a {}
for {set i 1} {$i<6} {set i [expr $i+1]} {
@@ -656,11 +650,11 @@ test for-6.5 {Tcl_ForObjCmd: number of args} {
catch {$z {set i 0} {$i < 5} {incr i} {body} extra} msg
set msg
} {wrong # args: should be "for start test next command"}
-test for-6.6 {Tcl_ForObjCmd: error in initial command} {
+test for-6.6 {Tcl_ForObjCmd: error in initial command} -body {
set z for
list [catch {$z {set} {$i < 5} {incr i} {body}} msg] $msg $errorInfo
-} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
("for" initial command)
invoked from within
@@ -677,12 +671,12 @@ test for-6.8 {Tcl_ForObjCmd: test expression is enclosed in quotes} {
$z {set i 6} "$i > 5" {incr i} {set y $i}
set i
} 6
-test for-6.9 {Tcl_ForObjCmd: error executing command body} {
+test for-6.9 {Tcl_ForObjCmd: error executing command body} -body {
set z for
catch {$z {set i 0} {$i < 5} {incr i} {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
("for" body line 1)
invoked from within
@@ -714,12 +708,12 @@ test for-6.12 {Tcl_ForObjCmd: computed command body} {
$z {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
set a
} {x1}
-test for-6.13 {Tcl_ForObjCmd: error in "next" command} {
+test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
set z for
catch {$z {set i 0} {$i < 5} {set} {set j 4}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
("for" loop-end command)
invoked from within
diff --git a/tests/if.test b/tests/if.test
index 1c79ef2..aec98f4 100644
--- a/tests/if.test
+++ b/tests/if.test
@@ -10,10 +10,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: if.test,v 1.7 2001/12/04 15:36:29 dkf Exp $
+# RCS: @(#) $Id: if.test,v 1.8 2004/09/26 16:36:06 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
@@ -26,11 +26,10 @@ test if-1.1 {TclCompileIfCmd: missing if/elseif test} {
test if-1.2 {TclCompileIfCmd: error in if/elseif test} {
list [catch {if {[error "error in condition"]} foo} msg] $msg
} {1 {error in condition}}
-test if-1.3 {TclCompileIfCmd: error in if/elseif test} {
+test if-1.3 {TclCompileIfCmd: error in if/elseif test} -body {
list [catch {if {1+}} msg] $msg $errorInfo
-} {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression
- ("if" test expression)
- while compiling
+} -match glob -result {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression*
+ while *ing
"if {1+}"}}
test if-1.4 {TclCompileIfCmd: if/elseif test in braces} {
set a {}
@@ -63,15 +62,12 @@ test if-1.9 {TclCompileIfCmd: missing "then" body} {
catch {if 1<2 then} msg
set msg
} {wrong # args: no script following "then" argument}
-test if-1.10 {TclCompileIfCmd: error in "then" body} {
+test if-1.10 {TclCompileIfCmd: error in "then" body} -body {
set a {}
list [catch {if {$a!="xxx"} then {set}} msg] $msg $errorInfo
-} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- ("if" then script line 1)
- while compiling
-"if {$a!="xxx"} then {set}"}}
+} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}}
test if-1.11 {TclCompileIfCmd: error in "then" body} {
list [catch {if 2 then {[error "error in then clause"]}} msg] $msg
} {1 {error in then clause}}
@@ -177,12 +173,11 @@ test if-2.3 {TclCompileIfCmd: missing expression after "elseif"} {
catch {if 1<2 {set a 1} elseif} msg
set msg
} {wrong # args: no expression after "elseif" argument}
-test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} {
+test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} -body {
set a {}
list [catch {if 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo
-} {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression
- ("if" test expression)
- while compiling
+} -match glob -result {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression*
+ while *ing
"if 3>4 {set a 1} elseif {1>}"}}
test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long "elseif" body} {
catch {unset i}
@@ -304,16 +299,13 @@ test if-3.3 {TclCompileIfCmd: missing body after "else"} {
catch {if 2<1 {set a 1} else} msg
set msg
} {wrong # args: no script following "else" argument}
-test if-3.4 {TclCompileIfCmd: error compiling body after "else"} {
+test if-3.4 {TclCompileIfCmd: error compiling body after "else"} -body {
set a {}
catch {if 2<1 {set a 1} else {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- ("if" else script line 1)
- while compiling
-"if 2<1 {set a 1} else {set}"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
test if-3.5 {TclCompileIfCmd: extra arguments after "else" argument} {
set a {}
catch {if 2<1 {set a 1} else {set a 2} or something} msg
@@ -552,12 +544,12 @@ test if-5.9 {if cmd with computed command names: missing "then" body} {
catch {$z 1<2 then} msg
set msg
} {wrong # args: no script following "then" argument}
-test if-5.10 {if cmd with computed command names: error in "then" body} {
+test if-5.10 {if cmd with computed command names: error in "then" body} -body {
set z if
set a {}
list [catch {$z {$a!="xxx"} then {set}} msg] $msg $errorInfo
-} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
invoked from within
"$z {$a!="xxx"} then {set}"}}
@@ -807,13 +799,13 @@ test if-7.3 {if cmd with computed command names: missing body after "else"} {
catch {$z 2<1 {set a 1} else} msg
set msg
} {wrong # args: no script following "else" argument}
-test if-7.4 {if cmd with computed command names: error compiling body after "else"} {
+test if-7.4 {if cmd with computed command names: error compiling body after "else"} -body {
set z if
set a {}
catch {$z 2<1 {set a 1} else {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
invoked from within
"$z 2<1 {set a 1} else {set}"}
diff --git a/tests/incr.test b/tests/incr.test
index 309b757..bdf0b76 100644
--- a/tests/incr.test
+++ b/tests/incr.test
@@ -10,10 +10,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: incr.test,v 1.9 2003/04/28 12:34:33 dkf Exp $
+# RCS: @(#) $Id: incr.test,v 1.10 2004/09/26 16:36:06 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
@@ -174,15 +174,13 @@ test incr-1.18 {TclCompileIncrCmd: increment given, simple int} {
set i 5
incr i -100
} -95
-test incr-1.19 {TclCompileIncrCmd: increment given, but erroneous} {
+test incr-1.19 {TclCompileIncrCmd: increment given, but erroneous} -body {
set i 5
catch {incr i [set]} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"incr i [set]"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
test incr-1.20 {TclCompileIncrCmd: increment given, in quotes} {
set i 25
incr i "-100"
@@ -218,13 +216,11 @@ test incr-1.26 {TclCompileIncrCmd: runtime error, bad variable name} {
(reading value of variable to increment)
invoked from within
"incr {"foo}"}}
-test incr-1.27 {TclCompileIncrCmd: runtime error, bad variable name} {
+test incr-1.27 {TclCompileIncrCmd: runtime error, bad variable name} -body {
list [catch {incr [set]} msg] $msg $errorInfo
-} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"incr [set]"}}
+} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}}
test incr-1.28 {TclCompileIncrCmd: runtime error, readonly variable} {
proc readonly args {error "variable is read-only"}
set x 123
@@ -426,16 +422,14 @@ test incr-2.18 {incr command (not compiled): increment given, simple int} {
set i 5
$z i -100
} -95
-test incr-2.19 {incr command (not compiled): increment given, but erroneous} {
+test incr-2.19 {incr command (not compiled): increment given, but erroneous} -body {
set z incr
set i 5
catch {$z i [set]} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"$z i [set]"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
test incr-2.20 {incr command (not compiled): increment given, in quotes} {
set z incr
set i 25
@@ -478,14 +472,12 @@ test incr-2.26 {incr command (not compiled): runtime error, bad variable name} {
(reading value of variable to increment)
invoked from within
"$z {"foo}"}}
-test incr-2.27 {incr command (not compiled): runtime error, bad variable name} {
+test incr-2.27 {incr command (not compiled): runtime error, bad variable name} -body {
set z incr
list [catch {$z [set]} msg] $msg $errorInfo
-} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- while compiling
-"$z [set]"}}
+} -match glob -result {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}}
test incr-2.28 {incr command (not compiled): runtime error, readonly variable} {
set z incr
proc readonly args {error "variable is read-only"}
diff --git a/tests/while.test b/tests/while.test
index 2fb396f..0352da4 100644
--- a/tests/while.test
+++ b/tests/while.test
@@ -10,10 +10,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: while.test,v 1.8 2001/12/04 15:36:29 dkf Exp $
+# RCS: @(#) $Id: while.test,v 1.9 2004/09/26 16:36:06 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
@@ -26,13 +26,12 @@ test while-1.1 {TclCompileWhileCmd: missing test expression} {
catch {while } msg
set msg
} {wrong # args: should be "while test command"}
-test while-1.2 {TclCompileWhileCmd: error in test expression} {
+test while-1.2 {TclCompileWhileCmd: error in test expression} -body {
set i 0
catch {while {$i<} break} msg
set errorInfo
-} {syntax error in expression "$i<": premature end of expression
- ("while" test expression)
- while compiling
+} -match glob -result {syntax error in expression "$i<": premature end of expression*
+ while *ing
"while {$i<} break"}
test while-1.3 {TclCompileWhileCmd: error in test expression} {
set err [catch {while {"a"+"b"} {error "loop aborted"}} msg]
@@ -66,16 +65,13 @@ test while-1.7 {TclCompileWhileCmd: missing command body} {
catch {while {$i < 5} } msg
set msg
} {wrong # args: should be "while test command"}
-test while-1.8 {TclCompileWhileCmd: error compiling command body} {
+test while-1.8 {TclCompileWhileCmd: error compiling command body} -body {
set i 0
catch {while {$i < 5} {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
-"set"
- ("while" body line 1)
- while compiling
-"while {$i < 5} {set}"}
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
+"set"*}
test while-1.9 {TclCompileWhileCmd: simple command body} {
set a {}
set i 1
@@ -350,13 +346,13 @@ test while-4.8 {while (not compiled): missing command body} {
catch {$z {$i < 5} } msg
set msg
} {wrong # args: should be "while test command"}
-test while-4.9 {while (not compiled): error compiling command body} {
+test while-4.9 {while (not compiled): error compiling command body} -body {
set i 0
set z while
catch {$z {$i < 5} {set}} msg
set errorInfo
-} {wrong # args: should be "set varName ?newValue?"
- while compiling
+} -match glob -result {wrong # args: should be "set varName ?newValue?"
+ while *ing
"set"
("while" body line 1)
invoked from within