summaryrefslogtreecommitdiffstats
path: root/contrib/tcl/tests/expr.test
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcl/tests/expr.test')
-rw-r--r--contrib/tcl/tests/expr.test25
1 files changed, 15 insertions, 10 deletions
diff --git a/contrib/tcl/tests/expr.test b/contrib/tcl/tests/expr.test
index 481e3ab..e0825f9 100644
--- a/contrib/tcl/tests/expr.test
+++ b/contrib/tcl/tests/expr.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# SCCS: @(#) expr.test 1.29 97/06/23 18:46:25
+# SCCS: @(#) expr.test 1.33 97/08/07 10:45:57
if {[string compare test [info procs test]] == 1} then {source defs}
@@ -77,7 +77,7 @@ test expr-1.2 {TclCompileExprCmd: one expression word} {
expr -25
} -25
test expr-1.3 {TclCompileExprCmd: two expression words} {
- format %.6g [expr -8.2 -6]
+ expr -8.2 -6
} -14.2
test expr-1.4 {TclCompileExprCmd: five expression words} {
expr 20 - 5 +10 -7
@@ -117,6 +117,11 @@ test expr-1.13 {TclCompileExprCmd: second level of substitutions in expr not in
set x 27; set bool {$x}; if $bool {set a foo}
set a
} foo
+test expr-1.14 {TclCompileExprCmd: second level of substitutions in expr with comparison as top-level operator} {
+ set a xxx
+ set x 2; set b {$x}; set a [expr $b == 2]
+ set a
+} 1
test expr-2.1 {TclCompileExpr: are builtin functions registered?} {
expr double(5*[llength "6 2"])
@@ -426,7 +431,7 @@ test expr-14.3 {CompilePrimaryExpr: literal primary} {expr 0xff} 255
test expr-14.4 {CompilePrimaryExpr: literal primary} {expr 00010} 8
test expr-14.5 {CompilePrimaryExpr: literal primary} {expr 62.0} 62.0
test expr-14.6 {CompilePrimaryExpr: literal primary} {
- format %.6g [expr 3.1400000]
+ expr 3.1400000
} 3.14
test expr-14.7 {CompilePrimaryExpr: literal primary} {expr {{abcde}<{abcdef}}} 1
test expr-14.8 {CompilePrimaryExpr: literal primary} {expr {{abc\
@@ -466,7 +471,7 @@ test expr-14.16 {CompilePrimaryExpr: error compiling var reference primary} {
} {missing )
(parsing index for array "a")
while compiling
-"expr"}
+"expr {$a(foo}"}
test expr-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {
expr $
} $
@@ -476,12 +481,12 @@ test expr-14.18 {CompilePrimaryExpr: quoted string primary} {
test expr-14.19 {CompilePrimaryExpr: quoted string primary} {
set i 123
set x 456
- format %.6g [expr "$i+$x"]
+ expr "$i+$x"
} 579
test expr-14.20 {CompilePrimaryExpr: quoted string primary} {
set i 3
set x 6
- format %.6g [expr 2+"$i.$x"]
+ expr 2+"$i.$x"
} 5.6
test expr-14.21 {CompilePrimaryExpr: error in quoted string primary} {
catch {expr "[set]"} msg
@@ -497,15 +502,15 @@ test expr-14.23 {CompilePrimaryExpr: error in subcommand primary} {
while compiling
"set"
while compiling
-"expr"}
+"expr {[set]}"}
test expr-14.24 {CompilePrimaryExpr: error in subcommand primary} {
catch {expr {[set i}} msg
set errorInfo
} {missing close-bracket or close-brace
while compiling
-"set"
+"set i"
while compiling
-"expr"}
+"expr {[set i}"}
test expr-14.25 {CompilePrimaryExpr: math function primary} {
format %.6g [expr exp(1.0)]
} 2.71828
@@ -528,7 +533,7 @@ test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} {
while compiling
"set"
while compiling
-"expr"}
+"expr 2+(3*[set])"}
test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} {
catch {expr 2+(3*(4+5)} msg
set errorInfo
OpenPOWER on IntegriCloud