diff options
Diffstat (limited to 'tests/compExpr.test')
-rw-r--r-- | tests/compExpr.test | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/compExpr.test b/tests/compExpr.test index eec796e..42e5cd5 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.8 2004/09/26 16:36:05 msofer Exp $ +# RCS: @(#) $Id: compExpr.test,v 1.9 2005/05/10 18:35:17 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -29,9 +29,10 @@ test compExpr-1.1 {TclCompileExpr procedure, successful expr parse and compile} test compExpr-1.2 {TclCompileExpr procedure, error parsing expr} { list [catch {expr 1+2+} msg] $msg } {1 {syntax error in expression "1+2+": premature end of expression}} -test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} { +test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} -body { list [catch {expr "foo(123)"} msg] $msg -} {1 {unknown math function "foo"}} +} -match glob -result {1 {* "*foo"}} + test compExpr-1.4 {TclCompileExpr procedure, expr has no operators} { set a {000123} expr {$a} @@ -94,9 +95,9 @@ test compExpr-2.14 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, op found test compExpr-2.15 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function found} { format %.6g [expr {sin(2.0)}] } 0.909297 -test compExpr-2.16 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function not found} { +test compExpr-2.16 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, math function not found} -body { list [catch {expr {fred(2.0)}} msg] $msg -} {1 {unknown math function "fred"}} +} -match glob -result {1 {* "*fred"}} test compExpr-2.17 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, normal operator} { expr {4*2} } 8 @@ -289,30 +290,30 @@ test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} { test compExpr-5.1 {CompileMathFuncCall procedure, math function found} { format %.6g [expr atan2(1.0, 2.0)] } 0.463648 -test compExpr-5.2 {CompileMathFuncCall procedure, math function not found} { +test compExpr-5.2 {CompileMathFuncCall procedure, math function not found} -body { list [catch {expr {do_it()}} msg] $msg -} {1 {unknown math function "do_it"}} +} -match glob -result {1 {* "*do_it"}} test compExpr-5.3 {CompileMathFuncCall: call registered math function} testmathfunctions { expr 3*T1()-1 } 368 test compExpr-5.4 {CompileMathFuncCall: call registered math function} testmathfunctions { expr T2()*3 } 1035 -test compExpr-5.5 {CompileMathFuncCall procedure, too few arguments} { +test compExpr-5.5 {CompileMathFuncCall procedure, too few arguments} -body { list [catch {expr {atan2(1.0)}} msg] $msg -} {1 {too few arguments for math function}} +} -match glob -result {1 {too few arguments for math function*}} test compExpr-5.6 {CompileMathFuncCall procedure, complex argument} { format %.6g [expr pow(2.1, 27.5-(24.4*(5%2)))] } 9.97424 test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} { list [catch {expr {sinh(2.*)}} msg] $msg } {1 {syntax error in expression "sinh(2.*)": unexpected close parenthesis}} -test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} { +test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} -body { list [catch {expr {sinh(2.0, 3.0)}} msg] $msg -} {1 {too many arguments for math function}} -test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} { +} -match glob -result {1 {too many arguments for math function*}} +test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} -body { list [catch {expr {0 <= rand(5.2)}} msg] $msg -} {1 {too many arguments for math function}} +} -match glob -result {1 {too many arguments for math function*}} test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} { list [catch {expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3} msg] $msg |