use v6-alpha; use Test; =pod This file was derived from the perl5 CPAN module Perl6::Rules, version 0.3 (12 Apr 2004), file t/prior.t. It has (hopefully) been, and should continue to be, updated to be valid perl6. =cut plan 31; if !eval('("a" ~~ /a/)') { skip_rest "skipped tests - rules support appears to be missing"; } else { ok(!eval(' "A" ~~ m// '), 'No prior successful match'); ok($!, 'Error', :todo ); ok("A" ~~ m/<[A-Z]>/, 'Successful match'); ok("B" ~~ m//, 'Prior successful match'); ok(!( "!" ~~ m// ), 'Prior successful non-match'); ok(!( "A" ~~ m/B/ ), 'Unsuccessful match'); ok("B" ~~ m//, 'Still prior successful match'); ok("B" ~~ m//, 'And still prior successful match'); ok("AB" ~~ m/A /, 'Nested prior successful match'); ok(!( "A" ~~ m/A / ), 'Nested prior successful non-match'); ok("B" ~~ m//, 'And even now prior successful match', :todo ); ok("!" ~~ m/<-[A-Z]>/, 'New successful match'); ok(!( "B" ~~ m// ), 'New prior successful non-match'); ok("!" ~~ m//, 'New prior successful match' ); ok(!( "A" ~~ m/B/ ), 'New unsuccessful match'); ok("%" ~~ m//, 'New still prior successful match'); ok("@" ~~ m//, 'New and still prior successful match'); ok("A!" ~~ m/A /, 'New nested prior successful match'); ok(!( "A" ~~ m/A / ), 'New nested prior successful non-match'); ok("^" ~~ m//, 'New and even now prior successful match', :todo ); ok("A" ~~ m/<[A-Z]>/, 'Another successful match'); ok("AA" ~~ m/^ + $/, 'Repeated prior' ); is($/, "AA", 'Matched fully' ); ok("A" ~~ m/^ $/, 'Captured prior', :todo ); is($/, "A", 'Captured correctly', :todo ); ok("AAAA" ~~ m/^ + $/, 'Repeatedly captured prior', :todo ); is(try { $/[0] }, 'A', 'Capture 0', :todo ); is(try { $/[1] }, 'A', 'Capture 1', :todo ); is(try { $/[2] }, 'A', 'Capture 2', :todo ); is(try { $/[3] }, 'A', 'Capture 3', :todo ); ok(try {! defined($/[4]) }, 'Capture 4', :todo ); }