Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 89 lines (63 sloc) 2.347 kb
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
1 use v6;
2
3 use Test;
4
5 =begin pod
6
7 This file was derived from the perl5 CPAN module Perl6::Rules,
8 version 0.3 (12 Apr 2004), file t/subrule.t.
9
10 It has (hopefully) been, and should continue to be, updated to
11 be valid perl6.
12
13 =end pod
14
b47bf2d8 »
2011-10-07 RT #96424, capture from unsuccessful match
15 plan 36;
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
16
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
17 # L<S05/Match objects/When used as a hash>
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
18
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
19 my regex abc {abc}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
20
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
21 my regex once {<&abc>}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
22
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
23 ok("abcabcabcabcd" ~~ m/<&once>/, 'Once match');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
24 ok($/, 'Once matched');
25 is(~$/, "abc", 'Once matched');
b8687da9 »
2011-02-28 Refudge a few evals for niecza
26 #?niecza skip 'auto $0 confuses this'
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
27 ok(@($/) == 0, 'Once no array capture');
28 ok(%($/).keys == 0, 'Once no hash capture');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
29
30
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
31 my regex rep {<&abc>**{4}}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
32
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
33 ok("abcabcabcabcd" ~~ m/<&rep>/, 'Rep match');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
34 ok($/, 'Rep matched');
35 is(~$/, "abcabcabcabc", 'Rep matched');
b8687da9 »
2011-02-28 Refudge a few evals for niecza
36 #?niecza skip 'auto $0 confuses this'
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
37 ok(@($/) == 0, 'Rep no array capture');
38 ok(%($/).keys == 0, 'Rep no hash capture');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
39
40
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
41 my regex cap {<abc=&abc>}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
42
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
43 ok("abcabcabcabcd" ~~ m/<cap=&cap>/, 'Cap match');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
44 ok($/, 'Cap matched');
45 is(~$/, "abc", 'Cap zero matched');
46 is(~$/<cap>, "abc", 'Cap captured');
47
48 is(~$/<cap><abc>, "abc", 'Cap abc captured');
b8687da9 »
2011-02-28 Refudge a few evals for niecza
49 #?niecza skip 'auto $0 confuses this'
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
50 ok(@($/) == 0, 'Cap no array capture');
51 ok(%($/).keys == 1, 'Cap hash capture');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
52
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
53 my regex repcap {<abc=&abc>**{4}}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
54
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
55 ok("abcabcabcabcd" ~~ m/<repcap=&repcap>/, 'Repcap match');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
56 ok($/, 'Repcap matched');
57 is(~$/, "abcabcabcabc", 'Repcap matched');
58 is(~$/<repcap>, "abcabcabcabc", 'Repcap captured');
59 is(~$/<repcap><abc>[0], "abc", 'Repcap abc zero captured');
60 is(~$/<repcap><abc>[1], "abc", 'Repcap abc one captured');
61 is(~$/<repcap><abc>[2], "abc", 'Repcap abc two captured');
62 is(~$/<repcap><abc>[3], "abc", 'Repcap abc three captured');
b8687da9 »
2011-02-28 Refudge a few evals for niecza
63 #?niecza skip 'auto $0 confuses this'
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
64 ok(@($/) == 0, 'Repcap no array capture');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
65
66
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
67 my regex caprep {(<&abc>**{4})}
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
68
fccd70cc »
2010-05-29 [t/spec] bring subrule.t up to date wrt current spec; fudge for rakudo
69 ok("abcabcabcabcd" ~~ m/<caprep=&caprep>/, 'Caprep match');
986b6699 »
2009-02-01 [t] moved subrule.t to spec/
70 ok($/, 'Caprep matched');
71 is(~$/, "abcabcabcabc", 'Caprep matched');
72 is(~$/<caprep>, "abcabcabcabc", 'Caprep captured');
73 is(~$/<caprep>[0], "abcabcabcabc", 'Caprep abc one captured');
74
4d4775ea »
2010-11-01 [subrule.t] tests for RT #76892
75 # RT #76892
76 {
77 nok 'abc' !~~ /<alpha>(.)/, 'unsuccessful non-match';
78 is $0, 'b', 'failed !~~ still makes $0 available';
79 is $<alpha>, 'a', 'failed !~~ still makes $<foo> available';
80 }
81
b47bf2d8 »
2011-10-07 RT #96424, capture from unsuccessful match
82 # RT #96424
83 {
84 ok '0' ~~ /<alpha>|<digit>/, 'regex matches';
85 is $<alpha>.Str, '', 'Can call methods on captures from unsuccessful matches';
86 }
87
26cb83b4 »
2009-08-02 [t/spec] more smartlinks; simplified subrule.t a bit
88 # vim: ft=perl6
Something went wrong with that request. Please try again.