Skip to content

Commit 1641b95

Browse files
committed
Add test that when /regex/ sets $/ properly.
1 parent c8f64b9 commit 1641b95

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

S04-statements/given.t

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 51;
5+
plan 52;
66

77
=begin pod
88
@@ -309,4 +309,12 @@ Tests the given block, as defined in L<S04/"Switch statements">
309309
eval_lives_ok 'given 3 { sub a() { } }', 'can define a sub inside a given';
310310
eval_lives_ok 'sub a() { } given 3', 'can define a sub inside a statement-modifying given';
311311

312+
{
313+
my $capture-is-correct = False;
314+
given "Hello" {
315+
when /e(\w\w)/ { $capture-is-correct = $0 eq "ll"; }
316+
}
317+
ok $capture-is-correct, 'matches in when correctly set $0';
318+
}
319+
312320
# vim: ft=perl6

0 commit comments

Comments
 (0)