Skip to content

Commit

Permalink
Merge pull request #803 from vrurg/rakudo-4850
Browse files Browse the repository at this point in the history
Add test for topic within a nested closure
  • Loading branch information
vrurg committed Apr 11, 2022
2 parents bea5114 + 1e998fd commit d2646e2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion S04-statements/given.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 53;
plan 54;

=begin pod
Expand Down Expand Up @@ -435,4 +435,16 @@ eval-lives-ok 'sub a() { } given 3', 'can define a sub inside a statement-mo
ok $capture-is-correct, 'matches in when correctly set $0';
}

# Make sure lexically scoped topic is accessible within a nested closure.
# https://github.com/rakudo/rakudo/issues/4850
{
my &c;
given 'foo' {
when Str {
&c = { $_ };
}
}
is &c(), 'foo', 'lexical topic in a nested closure';
}

# vim: expandtab shiftwidth=4

0 comments on commit d2646e2

Please sign in to comment.