diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-05-23 21:27:05 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-05-23 22:09:36 +1000 |
commit | 2dd84967ea821e7bf650b8efcb8297122b83ad9b (patch) | |
tree | 5db721f3e3a97c32d842dab17a59635e7837d8b3 /tests/misc.test | |
parent | 080e321aba2ac6fac9300defec81e8efa3aba9b6 (diff) | |
download | jimtcl-2dd84967ea821e7bf650b8efcb8297122b83ad9b.zip jimtcl-2dd84967ea821e7bf650b8efcb8297122b83ad9b.tar.gz jimtcl-2dd84967ea821e7bf650b8efcb8297122b83ad9b.tar.bz2 |
Improve list parsing
Also add additional tests
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/misc.test')
-rw-r--r-- | tests/misc.test | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/misc.test b/tests/misc.test index f259185..706ee5e 100644 --- a/tests/misc.test +++ b/tests/misc.test @@ -366,4 +366,111 @@ test sharing-1.4 "Problems with ref sharing in arrays: lset" { set a(c) } {2 3} +test jimexpr-1.1 "integer ** operator" { + expr {2 ** 3} +} 8 + +test jimexpr-1.2 "integer ** operator" { + expr {0 ** 3} +} 0 + +test jimexpr-1.3 "integer ** operator" { + expr {2 ** 0} +} 1 + +test jimexpr-1.4 "integer ** operator" { + expr {-2 ** 1} +} -2 + +test jimexpr-1.5 "integer ** operator" { + expr {3 ** -2} +} 0 + +test jimexpr-1.6 "+ command" { + + 1 +} 1 + +test jimexpr-1.7 "+ command" { + + 2 3.5 +} 5.5 + +test jimexpr-1.8 "+ command" { + + 2 3 4 -6 +} 3 + +test jimexpr-1.9 "* command" { + * 4 +} 4 + +test jimexpr-1.10 "* command" { + * 4 2 +} 8 + +test jimexpr-1.11 "* command" { + * 4 2 -0.5 +} -4.0 + +test jimexpr-1.12 "/ command" { + / 2 +} 0.5 + +test jimexpr-1.12 "/ command" { + / 0.5 +} 2.0 + +test jimexpr-1.13 "/ command" { + / 12 3 +} 4 + +test jimexpr-1.14 "/ command" { + / 12 3 2.0 +} 2.0 + +test jimexpr-1.15 "- command" { + - 6 +} -6 + +test jimexpr-1.15 "- command" { + - 6.5 +} -6.5 + +test jimexpr-1.16 "- command" { + - 6 3 +} 3 + +test jimexpr-1.17 "- command" { + - 6 3 1.5 +} 1.5 + +test jimexpr-1.18 "errors in math commands" { + list [catch /] [catch {/ x}] [catch -] [catch {+ x y}] [catch {* x}] +} {1 1 1 1 1} + +# May be supported if support compiled in +test jimexpr-2.1 "double ** operator" { + catch {expr {2.0 ** 3}} result + expr {$result in {unsupported 8.0}} +} 1 + +# This one is for test coverage of an unusual case +test jimobj-1.1 "duplicate obj with no dupIntRepProc" { + proc "x x" {} { return 2 } + set a "x x" + # force it to be a command object + set b [$a] + # A second reference + set c $a + # Now force it to be duplicated + lset a 1 x + # force the duplicate object it to be a command object again + set b [$a] + # And get the string rep + set x "y $a" +} "y x x" + +test jim-badvar-1.1 "invalid variable name" { + set x b\0c + catch {set $x 5} +} 1 + testreport |