aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-05-13 10:07:50 +1000
committerSteve Bennett <steveb@workware.net.au>2023-05-25 08:56:24 +1000
commit1b151f816f14b11f1c1ef10b171411e21b9a504e (patch)
tree7e4702015b4ae17082283504e1f1bdc99f62093a /tests
parente0ea457f4f9e9dd8a7836e826cc9d2a5e607e698 (diff)
downloadjimtcl-1b151f816f14b11f1c1ef10b171411e21b9a504e.zip
jimtcl-1b151f816f14b11f1c1ef10b171411e21b9a504e.tar.gz
jimtcl-1b151f816f14b11f1c1ef10b171411e21b9a504e.tar.bz2
core: support multi-level while, break from loops
loop i 5 { loop j 6 { # This breaks out of both loops break 2 } } Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/jim.test22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/jim.test b/tests/jim.test
index b2a9337..e6de376 100644
--- a/tests/jim.test
+++ b/tests/jim.test
@@ -2002,9 +2002,13 @@ test foreach-7.3 {continue tests} {
} {b}
test foreach-7.4 {continue tests} {catch {continue foo} msg} 1
test foreach-7.5 {continue tests} {
+ catch {continue foo blah} msg
+ set msg
+} {wrong # args: should be "continue ?level?"}
+test foreach-7.6 {continue tests} {
catch {continue foo} msg
set msg
-} {wrong # args: should be "continue"}
+} {expected integer but got "foo"}
# Check "break".
@@ -2019,9 +2023,13 @@ test foreach-8.2 {break tests} {
} {a b}
test foreach-8.3 {break tests} {catch {break foo} msg} 1
test foreach-8.4 {break tests} {
- catch {break foo} msg
+ catch {break foo blah} msg
+ set msg
+} {wrong # args: should be "break ?level?"}
+test foreach-8.6 {break tests} {
+ catch {break foo} msg
set msg
-} {wrong # args: should be "break"}
+} {expected integer but got "foo"}
# Test for incorrect "double evaluation" semantics
@@ -2792,9 +2800,9 @@ test for-1.15 {TclCompileForCmd: for command result} {
# Check "for" and "continue".
test for-2.1 {TclCompileContinueCmd: arguments after "continue"} {
- catch {continue foo} msg
+ catch {continue foo blah} msg
set msg
-} {wrong # args: should be "continue"}
+} {wrong # args: should be "continue ?level?"}
test for-2.2 {TclCompileContinueCmd: continue result} {
catch continue
} 4
@@ -2863,9 +2871,9 @@ test for-2.6 {continue tests, long command body} {
# Check "for" and "break".
test for-3.1 {TclCompileBreakCmd: arguments after "break"} {
- catch {break foo} msg
+ catch {break foo blah} msg
set msg
-} {wrong # args: should be "break"}
+} {wrong # args: should be "break ?level?"}
test for-3.2 {TclCompileBreakCmd: break result} {
catch break
} 3