summaryrefslogtreecommitdiffstats
path: root/tests/interp.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-14 15:38:56 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-14 15:38:56 (GMT)
commit18bff61a75956fcde40e851c585128b4357abeb6 (patch)
tree1a471d66522d1f2079d4db81c469553f20bb0cf2 /tests/interp.test
parentc359e6c397870e97a217bd8acb51d120ed220088 (diff)
downloadtcl-18bff61a75956fcde40e851c585128b4357abeb6.zip
tcl-18bff61a75956fcde40e851c585128b4357abeb6.tar.gz
tcl-18bff61a75956fcde40e851c585128b4357abeb6.tar.bz2
Expanding the tests avilable for TIP#143 features.
Now check that basic syntax is verified.
Diffstat (limited to 'tests/interp.test')
-rw-r--r--tests/interp.test130
1 files changed, 129 insertions, 1 deletions
diff --git a/tests/interp.test b/tests/interp.test
index bf49282..78ad9c9 100644
--- a/tests/interp.test
+++ b/tests/interp.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: interp.test,v 1.28 2004/05/13 12:59:23 dkf Exp $
+# RCS: @(#) $Id: interp.test,v 1.29 2004/05/14 15:38:56 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -2917,6 +2917,134 @@ test interp-34.3 {basic test of limits - pure bytecode loop} knownBug {
set msg
} {1 {command count limit exceeded}}
+test interp-35.1 {interp limit syntax} -body {
+ interp limit
+} -returnCodes error -result {wrong # args: should be "interp limit path limitType ?options?"}
+test interp-35.2 {interp limit syntax} -body {
+ interp limit {}
+} -returnCodes error -result {wrong # args: should be "interp limit path limitType ?options?"}
+test interp-35.3 {interp limit syntax} -body {
+ interp limit {} foo
+} -returnCodes error -result {bad limit type "foo": must be commands or time}
+test interp-35.4 {interp limit syntax} -body {
+ set i [interp create]
+ set dict [interp limit $i commands]
+ set result {}
+ foreach key [lsort [dict keys $dict]] {
+ lappend result $key [dict get $dict $key]
+ }
+ set result
+} -cleanup {
+ interp delete $i
+} -result {-command {} -granularity 1 -value {}}
+test interp-35.5 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -granularity
+} -cleanup {
+ interp delete $i
+} -result 1
+test interp-35.6 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -granularity 2
+} -cleanup {
+ interp delete $i
+} -result {}
+test interp-35.7 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {bad option "-foobar": must be -command, -granularity, or -value}
+test interp-35.8 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -granularity foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {expected integer but got "foobar"}
+test interp-35.9 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -granularity 0
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {granularity must be at least 1}
+test interp-35.10 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -value foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {expected integer but got "foobar"}
+test interp-35.11 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i commands -value -1
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {command limit value must be at least 0}
+test interp-35.12 {interp limit syntax} -body {
+ set i [interp create]
+ set dict [interp limit $i time]
+ set result {}
+ foreach key [lsort [dict keys $dict]] {
+ lappend result $key [dict get $dict $key]
+ }
+ set result
+} -cleanup {
+ interp delete $i
+} -result {-command {} -granularity 10 -milliseconds {} -seconds {}}
+test interp-35.13 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -granularity
+} -cleanup {
+ interp delete $i
+} -result 10
+test interp-35.14 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -granularity 2
+} -cleanup {
+ interp delete $i
+} -result {}
+test interp-35.15 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {bad option "-foobar": must be -command, -granularity, -milliseconds, or -seconds}
+test interp-35.16 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -granularity foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {expected integer but got "foobar"}
+test interp-35.17 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -granularity 0
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {granularity must be at least 1}
+test interp-35.18 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -seconds foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {expected integer but got "foobar"}
+test interp-35.19 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -seconds -1
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {seconds must be at least 0}
+test interp-35.20 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -millis foobar
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {expected integer but got "foobar"}
+test interp-35.21 {interp limit syntax} -body {
+ set i [interp create]
+ interp limit $i time -millis -1
+} -cleanup {
+ interp delete $i
+} -returnCodes error -result {milliseconds must be at least 0}
+
# cleanup
foreach i [interp slaves] {
interp delete $i