diff --git a/S05-match/positions.t b/S05-match/positions.t index a0788315b0..b6190fcb93 100644 --- a/S05-match/positions.t +++ b/S05-match/positions.t @@ -8,7 +8,7 @@ version 0.3 (12 Apr 2004), file t/pos.t. =end pod -plan 12; +plan 13; my $str = "abrAcadAbbra"; @@ -33,4 +33,17 @@ is ('abc' ~~ /\d+/), Nil, 'Failed match returns Nil'; is-deeply $/.to, 6, 'List.to'; } +# RT #126249 +subtest '$/ is constructed in all blocks inside regexes' => { + plan 2; + my @res; + my token foo { + { @res.push: $/.to } + abc { @res.push: $/.to } + 123 { @res.push: $/.to } + }; + ok "abc123" ~~ //, 'regex matched'; + is-deeply @res, [0, 3, 6], 'blocks returned correct $/.to values'; +} + # vim: ft=perl6