aboutsummaryrefslogtreecommitdiff
path: root/tests/tailcall.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-09-30 16:08:57 +1000
committerSteve Bennett <steveb@workware.net.au>2011-10-21 11:43:06 +1000
commita61b052f4cf1f52c014879935f1a6db7fc5631be (patch)
tree252e9fccf225f0cb18bc9f102d8f15f7b8797f80 /tests/tailcall.test
parent50525ae1adbd8b6fab322a47c5df744781e054fb (diff)
downloadjimtcl-a61b052f4cf1f52c014879935f1a6db7fc5631be.zip
jimtcl-a61b052f4cf1f52c014879935f1a6db7fc5631be.tar.gz
jimtcl-a61b052f4cf1f52c014879935f1a6db7fc5631be.tar.bz2
Return from tailcall should be passed through
If a proc invokes a command via a tailcall and that command invokes "return", the return should be passed back to the caller of the proc. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/tailcall.test')
-rw-r--r--tests/tailcall.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tailcall.test b/tests/tailcall.test
index b7dab81..262ab0f 100644
--- a/tests/tailcall.test
+++ b/tests/tailcall.test
@@ -52,4 +52,17 @@ test tailcall-1.5 {interaction of uplevel and tailcall} {
a b
} {c c}
+test tailcall-1.6 {tailcall pass through return} {
+ proc a {script} {
+ # return from $script should pass through back to the caller
+ tailcall foreach i {1 2 3} $script
+ }
+ proc b {} {
+ a {return ok}
+ # Should not get here
+ return bad
+ }
+ b
+} {ok}
+
testreport