use v6; use Test; plan 6; =pod Testing named capture variables nested inside each other. This doesn't appear to be tested by the ported Perl6::Rules tests. That may be because it's not specified in the synopsis, but Autrijus is sure this how it ought to work. =cut # At the time of writing, these fail under Win32 so they are marked as bugs # I haven't yet run them under UNIX but I believe they will work if !eval('("a" ~~ /a/)') { skip_rest "skipped tests - rules support appears to be missing"; exit; } #L { regex fishy { (.*)shark }; "whaleshark" ~~ m//; is(eval('$/[0]'), "whale", "named rule ordinal capture"); is(eval('$[0]'), "whale", "named rule ordinal capture with abbreviated variable"); }; #L { my $not_really_a_mammal; regex fishy2 { $not_really_a_mammal := (.*)shark }; "whaleshark" ~~ m//; is(eval('$/'), "whale", "named rule named capture", :todo); is(eval('$'), "whale", "named rule named capture with abbreviated variable", :todo); }; #L { regex number { [ $ := { $ := 'roman' } | $ := { $ := 'arabic' } ] }; regex roman_numeral { I | II | III | IV }; regex arabic_numeral { 1 | 2 | 3 | 4 }; 2 ~~ m//; is(eval('$/'), '2', 'binding subrule to new alias'); is(eval('$/'), 'roman', 'binding to alias as side-effect'); }