Permalink
Browse files

[t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo

git-svn-id: http://svn.pugscode.org/pugs@30963 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 6ba965b commit fccd70cc3570fdd9d9698dfd4c8072ec7c9b47e9 moritz committed May 29, 2010
Showing with 19 additions and 19 deletions.
  1. +3 −8 S05-capture/named.t
  2. +16 −11 S05-capture/subrule.t
View
11 S05-capture/named.t
@@ -13,15 +13,10 @@ Testing named capture variables nested inside each other. This doesn't appear to
# 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<S05/Nested subpattern captures>
{
- regex fishy { (.*)shark };
+ my regex fishy { (.*)shark };
"whaleshark" ~~ m/<fishy>/;
is($/<fishy>[0], "whale", "named rule ordinal capture");
is($<fishy>[0], "whale", "named rule ordinal capture with abbreviated variable");
@@ -34,7 +29,7 @@ if !eval('("a" ~~ /a/)') {
#?rakudo todo '$alias = <other>'
{
my $not_really_a_mammal;
- regex fishy2 { $not_really_a_mammal = (.*)shark };
+ my regex fishy2 { $not_really_a_mammal = (.*)shark };
"whaleshark" ~~ m/<fishy2>/;
is($/<fishy2><not_really_a_mammal>, "whale", "named rule named capture");
is($<fishy2><not_really_a_mammal>, "whale", "named rule named capture with abbreviated variable");
@@ -44,7 +39,7 @@ if !eval('("a" ~~ /a/)') {
#?rakudo skip '$<alias> = <other>'
{
- regex number {
+ my regex number {
[ $<numeral> = <roman_numeral> { $<notation> = 'roman' }
| $<numeral> = <arabic_numeral> { $<notation> = 'arabic' }
]
View
27 S05-capture/subrule.t
@@ -16,53 +16,58 @@ plan 31;
# L<S05/Match objects/When used as a hash>
-regex abc {abc}
+my regex abc {abc}
-regex once {<.abc>}
+my regex once {<&abc>}
-ok("abcabcabcabcd" ~~ m/<.once>/, 'Once match');
+ok("abcabcabcabcd" ~~ m/<&once>/, 'Once match');
ok($/, 'Once matched');
is(~$/, "abc", 'Once matched');
+#?rakudo todo '@($/)'
ok(@($/) == 0, 'Once no array capture');
ok(%($/).keys == 0, 'Once no hash capture');
-regex rep {<.abc>**{4}}
+my regex rep {<&abc>**{4}}
-ok("abcabcabcabcd" ~~ m/<.rep>/, 'Rep match');
+ok("abcabcabcabcd" ~~ m/<&rep>/, 'Rep match');
ok($/, 'Rep matched');
is(~$/, "abcabcabcabc", 'Rep matched');
+#?rakudo todo '@($/)'
ok(@($/) == 0, 'Rep no array capture');
ok(%($/).keys == 0, 'Rep no hash capture');
-regex cap {<abc>}
+my regex cap {<abc=&abc>}
-ok("abcabcabcabcd" ~~ m/<cap>/, 'Cap match');
+ok("abcabcabcabcd" ~~ m/<cap=&cap>/, 'Cap match');
ok($/, 'Cap matched');
is(~$/, "abc", 'Cap zero matched');
is(~$/<cap>, "abc", 'Cap captured');
is(~$/<cap><abc>, "abc", 'Cap abc captured');
+#?rakudo todo '@($/)'
ok(@($/) == 0, 'Cap no array capture');
+#?rakudo todo '%($/)'
ok(%($/).keys == 1, 'Cap hash capture');
-regex repcap {<abc>**{4}}
+my regex repcap {<abc=&abc>**{4}}
-ok("abcabcabcabcd" ~~ m/<repcap>/, 'Repcap match');
+ok("abcabcabcabcd" ~~ m/<repcap=&repcap>/, 'Repcap match');
ok($/, 'Repcap matched');
is(~$/, "abcabcabcabc", 'Repcap matched');
is(~$/<repcap>, "abcabcabcabc", 'Repcap captured');
is(~$/<repcap><abc>[0], "abc", 'Repcap abc zero captured');
is(~$/<repcap><abc>[1], "abc", 'Repcap abc one captured');
is(~$/<repcap><abc>[2], "abc", 'Repcap abc two captured');
is(~$/<repcap><abc>[3], "abc", 'Repcap abc three captured');
+#?rakudo todo '@($/)'
ok(@($/) == 0, 'Repcap no array capture');
-regex caprep {(<.abc>**{4})}
+my regex caprep {(<&abc>**{4})}
-ok("abcabcabcabcd" ~~ m/<caprep>/, 'Caprep match');
+ok("abcabcabcabcd" ~~ m/<caprep=&caprep>/, 'Caprep match');
ok($/, 'Caprep matched');
is(~$/, "abcabcabcabc", 'Caprep matched');
is(~$/<caprep>, "abcabcabcabc", 'Caprep captured');

0 comments on commit fccd70c

Please sign in to comment.