Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
modify tests that assume <.foo> can call sub
  • Loading branch information
TimToady committed Nov 17, 2014
1 parent e75bba5 commit 3426474
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
7 changes: 3 additions & 4 deletions S05-capture/dot.t
Expand Up @@ -20,7 +20,7 @@ plan 61;

my regex dotdot { (.)(.) };

ok("zzzabcdefzzz" ~~ m/(a.)<.dotdot>(..)/, 'Match');
ok("zzzabcdefzzz" ~~ m/(a.)<.&dotdot>(..)/, 'Match');
ok($/, 'Matched');
is(~$/, "abcdef", 'Captured');
is(~$/[0], 'ab', '$/[0]');
Expand Down Expand Up @@ -70,12 +70,11 @@ is(~$/<single>, 'o', 'Named capture');
is(~$0, 'o', 'Backref capture');

#?rakudo 3 todo 'dubious test'
ok("bookkeeper" ~~ m/(<.single>) ($0)/, 'Positional backref');
ok("bookkeeper" ~~ m/(<.&single>) ($0)/, 'Positional backref');
is(~$0, 'o', 'Named capture');
is(~$1, 'o', 'Backref capture');

ok(!( "bokeper" ~~ m/(<.single>) ($0)/ ), 'Failed positional backref');
# XXX wtf?
ok(!( "bokeper" ~~ m/(<.&single>) ($0)/ ), 'Failed positional backref');
ok !( "bokeper" ~~ m/<single> ($<single>)/ ) , 'Failed named backref';

is("\$0", '$'~'0', 'Non-translation of non-interpolated "\\$0"');
Expand Down
25 changes: 10 additions & 15 deletions S05-metasyntax/longest-alternative.t
Expand Up @@ -60,51 +60,46 @@ my $str = 'a' x 7;
my token indirect_abb { <ab> 'b' }

#?niecza todo 'LTM - literals in tokens'
#?rakudo todo 'LTM - literals in tokens'
ok ('abb' ~~ /<&ab> | <&abb> /) && ~$/ eq 'abb',
ok ('abb' ~~ /<ab> | <abb> /) && ~$/ eq 'abb',
'LTM - literals in tokens';

#?niecza todo 'LTM - literals in nested tokens'
#?rakudo todo 'LTM - literals in tokens'
ok ('abb' ~~ /<&ab> | <&indirect_abb> /) && $/ eq 'abb',
ok ('abb' ~~ /<ab> | <indirect_abb> /) && $/ eq 'abb',
'LTM - literals in nested torkens';

ok ('abb' ~~ /'ab' | \w+ / && $/) eq 'abb',
'LTM - longer quantified charclass wins against shorter literal';

#?niecza todo 'LTM - longer quantified atom wins against shorter literal (subrules)'
#?rakudo todo 'LTM - longer quantified atom wins against shorter literal (subrules)'
ok ('abb' ~~ /<&ab> | <&a_word> /) && $/ eq 'abb',
ok ('abb' ~~ /<ab> | <a_word> /) && $/ eq 'abb',
'LTM - longer quantified atom wins against shorter literal (subrules)';

#?niecza todo 'LTM - literal wins tie against \w*'
#?rakudo todo 'LTM - literal wins tie against \w*'
ok ('abb' ~~ / <&word> | <abb=&abb> /) && $<abb>,
ok ('abb' ~~ / <word> | <abb> /) && $<abb>,
'LTM - literal wins tie against \w*';
}

#?rakudo skip ':::'
#?rakudo skip '::'
{
# with LTM stoppers
my token foo1 {
a+
::: # a LTM stopper
:: # a LTM stopper
.+
}
my token foo2 { \w+ }

#?niecza todo 'LTM only participated up to the LTM stopper :::'
ok ('aaab---' ~~ /<&foo1> | <foo2=&foo2> /) && $<foo2>,
'LTM only participated up to the LTM stopper :::';
#?niecza todo 'LTM only participated up to the LTM stopper ::'
ok ('aaab---' ~~ /<foo1> | <foo2> /) && $<foo2>,
'LTM only participated up to the LTM stopper ::';
}

# LTM stopper by implicit <.ws>
#?niecza todo 'implicit <.ws> stops LTM'
#?rakudo todo 'implicit <.ws> stops LTM'
{
my rule ltm_ws1 {\w+ '-'+}
my token ltm_ws2 {\w+ '-'}
ok ('abc---' ~~ /<&ltm_ws1> | <ltm_ws2=&ltm_ws2>/) && $<ltm_ws2>,
ok ('abc---' ~~ /<ltm_ws1> | <ltm_ws2>/) && $<ltm_ws2>,
'implicit <.ws> stops LTM';
}

Expand Down

0 comments on commit 3426474

Please sign in to comment.