Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
start to switch regex tests from ** to %
  • Loading branch information
moritz committed Nov 20, 2011
1 parent 41f3591 commit e2b7423
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions S05-metasyntax/repeat.t
Expand Up @@ -47,18 +47,16 @@ ok(!( "abcd" ~~ m/'abc'**{2..*}/), 'Fail open range repetition using closu
eval_dies_ok('"foo" ~~ m/o{1,3}/', 'P5-style {1,3} range mistake is caught');
eval_dies_ok('"foo" ~~ m/o{1,}/', 'P5-style {1,} range mistake is caught');

# A successful match of such a quantifier always ends "in the middle"
is(~('foo,bar,baz,' ~~ m/[<alpha>+] ** ','/), 'foo,bar,baz', '** with a term worked');
is(~('foo,bar,baz,' ~~ m/[<alpha>+] **? ','/), 'foo', '**? with a term worked');
is(~('foo, bar,' ~~ m/[<alpha>+] **[','\s*]/), 'foo, bar', '** with a more complex term');
is(~('foo,bar,baz,' ~~ m/[<alpha>+]+ % ','/), 'foo,bar,baz', '% with a term worked');
is(~('foo,bar,baz,' ~~ m/[<alpha>+]+ %% ','/), 'foo,bar,baz,', '%% with a term worked');
is(~('foo, bar,' ~~ m/[<alpha>+]+ % [','\s*]/), 'foo, bar', '% with a more complex term');

ok 'a, b, c' !~~ /:s^<alpha>**\,$/, 'with no spaces around **, no spaces can be matched';
#?rakudo todo 'nom regression'
ok 'a, b, c' ~~ /:s^ <alpha> ** \, $/, 'with spaces around **, spaces can be matched';
#?rakudo todo 'nom regression'
ok 'a , b ,c' ~~ /:s^ <alpha> ** \, $/, 'same, but with leading spaces';
#?rakudo 3 skip 'nom regression'
ok 'a, b, c' !~~ /:s^<alpha>+%\,$/, 'with no spaces around %, no spaces can be matched';
ok 'a, b, c' ~~ /:s^ <alpha>+ % \, $/, 'with spaces around %, spaces can be matched';
ok 'a , b ,c' ~~ /:s^ <alpha>+ % \, $/, 'same, but with leading spaces';

# RT #76792
ok ('a b,c,d' ~~ token { \w \s \w ** \, }), 'can combine ** with backslash character classes';
ok ('a b,c,d' ~~ token { \w \s \w+ % \, }), 'can combine % with backslash character classes';

# vim: ft=perl6

0 comments on commit e2b7423

Please sign in to comment.