diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-09-26 16:36:03 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-09-26 16:36:03 (GMT) |
commit | 381c3c6ea98688e498a8b9fd86ce4493cd2c95ed (patch) | |
tree | 91eee036738fa2310e571bb36ed444c5e73b0ff4 /tests/expr.test | |
parent | bb1852395b8d68573b6f01b8ac22a13851cfdf51 (diff) | |
download | tcl-381c3c6ea98688e498a8b9fd86ce4493cd2c95ed.zip tcl-381c3c6ea98688e498a8b9fd86ce4493cd2c95ed.tar.gz tcl-381c3c6ea98688e498a8b9fd86ce4493cd2c95ed.tar.bz2 |
Report compilation errors at runtime, [Patch 103368] by dgp.
Diffstat (limited to 'tests/expr.test')
-rw-r--r-- | tests/expr.test | 90 |
1 files changed, 43 insertions, 47 deletions
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() |