Skip to content

Commit fe57091

Browse files
committed
Add tests for RT #114042 (variants of R #1216)
skipped for JVM because the R #1216 test is skipped
1 parent 0b82765 commit fe57091

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

S04-statements/return.t

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use lib $?FILE.IO.parent(2).add("packages");
44
use Test;
55
use Test::Util;
66

7-
plan 24;
7+
plan 26;
88

99
# Is there a better reference for the spec for how return return works?
1010
# There is "return function" but that's a more advanced feature.
@@ -104,11 +104,20 @@ throws-like Q[sub {CHECK return;}],
104104
'CHECK return handled correctly';
105105

106106
# https://github.com/rakudo/rakudo/issues/1216
107-
#?rakudo.jvm skip 'UnwindException'
107+
#?rakudo.jvm 3 skip 'UnwindException'
108108
throws-like sub { eager sub { ^1 .map: { return } }() }(),
109109
X::ControlFlow::Return, :out-of-dynamic-scope{.so},
110110
'X::ControlFlow::Return tells when return is outside of dyn scope';
111+
# RT #114042
112+
throws-like sub a1 { my &x = { return }; &x }; my &y = a1; &y(),
113+
X::ControlFlow::Return, :out-of-dynamic-scope{.so},
114+
'X::ControlFlow::Return tells when return is outside of dyn scope';
115+
throws-like sub a2 { my &x = { return }; &x }; sub b1(&x) { &x() }; b1(a2),
116+
X::ControlFlow::Return, :out-of-dynamic-scope{.so},
117+
'X::ControlFlow::Return tells when return is outside of dyn scope';
111118
throws-like return, X::ControlFlow::Return, :out-of-dynamic-scope{.not},
112119
'bare return does not set $.out-of-dynamic-scope';
113120

121+
122+
114123
# vim: ft=perl6

0 commit comments

Comments
 (0)