Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 130 lines (122 sloc) 7.99 kb
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
1 use v6;
2
3 use Test;
4
5 plan 102;
6
7 #L<S05/Modifiers/"The extended syntax">
8
9 unless "a" ~~ rx:P5/a/ {
10 skip_rest "skipped tests - P5 regex support appears to be missing";
11 exit;
12 }
13
14 my $b = 'x';
15 my $backspace = "\b";
16 my $bang = '!';
17
18 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){2}(.)/ && $0), "b", 're_tests 609/1 (793)');
19 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){4,5}(.)/ && $0), "b", 're_tests 611/1 (795)');
20 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){4,5}?(.)/ && $0), "d", 're_tests 613/1 (797)');
21 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){6,7}(.)/ && $0), "e", 're_tests 615/1 (799)');
22 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){6,7}?(.)/ && $0), "e", 're_tests 617/1 (801)');
23 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,6}(.)/ && $0), "e", 're_tests 619/1 (803)');
24 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,6}?(.)/ && $0), "b", 're_tests 621/1 (805)');
25 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,7}(.)/ && $0), "e", 're_tests 623/1 (807)');
26 is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,7}?(.)/ && $0), "b", 're_tests 625/1 (809)');
27 is(("AB" ~~ rx:P5/^(.+)?B/ && $0), "A", 're_tests 627/1 (811)');
28 is(("." ~~ rx:P5/^([^a-z])|(\^)$/ && $0), ".", 're_tests 629/1 (813)');
29 is(("<&OUT" ~~ rx:P5/^[<>]&/ && $/), "<&", 're_tests 631/0 (815)');
30 is(("aaaaaaaaaa" ~~ rx:P5/^(a\1?){4}$/ && $0), "aaaa", 're_tests 633/1 (817)');
31 ok((not ("aaaaaaaaa" ~~ rx:P5/^(a\1?){4}$/)), 're_tests 635 (819)');
32 ok((not ("aaaaaaaaaaa" ~~ rx:P5/^(a\1?){4}$/)), 're_tests 637 (821)');
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
33 #?rakudo 3 skip "(?(1)...) syntax NYI"
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
34 is(("aaaaaaaaaa" ~~ rx:P5/^(a(?(1)\1)){4}$/ && $0), "aaaa", 're_tests 639/1 (823)');
35 ok((not ("aaaaaaaaa" ~~ rx:P5/^(a(?(1)\1)){4}$/)), 're_tests 641 (825)');
36 ok((not ("aaaaaaaaaaa" ~~ rx:P5/^(a(?(1)\1)){4}$/)), 're_tests 643 (827)');
37 is(("aaaaaaaaa" ~~ rx:P5/((a{4})+)/ && $0), "aaaaaaaa", 're_tests 645/1 (829)');
38 is(("aaaaaaaaaa" ~~ rx:P5/(((aa){2})+)/ && $0), "aaaaaaaa", 're_tests 647/1 (831)');
39 is(("aaaaaaaaaa" ~~ rx:P5/(((a{2}){2})+)/ && $0), "aaaaaaaa", 're_tests 649/1 (833)');
40 is(("ab" ~~ rx:P5/(?<=a)b/ && $/), "b", 're_tests 651/0 (835)');
41 ok((not ("cb" ~~ rx:P5/(?<=a)b/)), 're_tests 653 (837)');
42 ok((not ("b" ~~ rx:P5/(?<=a)b/)), 're_tests 655 (839)');
43 is(("ab" ~~ rx:P5/(?<!c)b/ && $/), "b", 're_tests 657/0 (841)');
44 ok((not ("cb" ~~ rx:P5/(?<!c)b/)), 're_tests 659 (843)');
45 ok(("b" ~~ rx:P5/(?<!c)b/), 're_tests 661 (845)');
46 is(("b" ~~ rx:P5/(?<!c)b/ && $/), "b", 're_tests 663/0 (847)');
47 is(("aba" ~~ rx:P5/(?:..)*a/ && $/), "aba", 're_tests 665/0 (849)');
48 is(("aba" ~~ rx:P5/(?:..)*?a/ && $/), "a", 're_tests 667/0 (851)');
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
49 #?rakudo todo "unknown issue"
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
50 is(("abc" ~~ rx:P5/^(?:b|a(?=(.)))*\1/ && $/), "ab", 're_tests 669/0 (853)');
51 is(("aax" ~~ rx:P5/^(a+)*ax/ && $0), "a", 're_tests 671/1 (855)');
52 is(("aax" ~~ rx:P5/^((a|b)+)*ax/ && $0), "a", 're_tests 673/1 (857)');
53 is(("aax" ~~ rx:P5/^((a|bc)+)*ax/ && $0), "a", 're_tests 675/1 (859)');
54 is(("ab" ~~ rx:P5/(?:(?i)a)b/ && $/), "ab", 're_tests 677/0 (861)');
55 is(("ab" ~~ rx:P5/((?i)a)b/ && $/), "ab", 're_tests 679/0 (863)');
56 is(("ab" ~~ rx:P5/((?i)a)b/ && $0), "a", 're_tests 679/1 (864)');
57 is(("Ab" ~~ rx:P5/(?:(?i)a)b/ && $/), "Ab", 're_tests 681/0 (867)');
58 is(("Ab" ~~ rx:P5/((?i)a)b/ && $/), "Ab", 're_tests 683/0 (869)');
59 is(("Ab" ~~ rx:P5/((?i)a)b/ && $0), "A", 're_tests 683/1 (870)');
60 ok((not ("aB" ~~ rx:P5/(?:(?i)a)b/)), 're_tests 685 (873)');
61 ok((not ("aB" ~~ rx:P5/((?i)a)b/)), 're_tests 687 (875)');
62 is(("ab" ~~ rx:P5/(?i:a)b/ && $/), "ab", 're_tests 689/0 (877)');
63 is(("ab" ~~ rx:P5/((?i:a))b/ && $/), "ab", 're_tests 691/0 (879)');
64 is(("ab" ~~ rx:P5/((?i:a))b/ && $0), "a", 're_tests 691/1 (880)');
65 is(("Ab" ~~ rx:P5/(?i:a)b/ && $/), "Ab", 're_tests 693/0 (883)');
66 is(("Ab" ~~ rx:P5/((?i:a))b/ && $/), "Ab", 're_tests 695/0 (885)');
67 is(("Ab" ~~ rx:P5/((?i:a))b/ && $0), "A", 're_tests 695/1 (886)');
68 ok((not ("aB" ~~ rx:P5/(?i:a)b/)), 're_tests 697 (889)');
69 ok((not ("aB" ~~ rx:P5/((?i:a))b/)), 're_tests 699 (891)');
70 is(("ab" ~~ rx:P5/(?i)(?:(?-i)a)b/ && $/), "ab", 're_tests 701/0 (893)');
71 is(("ab" ~~ rx:P5/(?i)((?-i)a)b/ && $/), "ab", 're_tests 702/0 (894)');
72 is(("ab" ~~ rx:P5/(?i)((?-i)a)b/ && $0), "a", 're_tests 702/1 (895)');
73 is(("aB" ~~ rx:P5/(?i)(?:(?-i)a)b/ && $/), "aB", 're_tests 703/0 (896)');
74 is(("aB" ~~ rx:P5/(?i)((?-i)a)b/ && $/), "aB", 're_tests 704/0 (897)');
75 is(("aB" ~~ rx:P5/(?i)((?-i)a)b/ && $0), "a", 're_tests 704/1 (898)');
76 ok((not ("Ab" ~~ rx:P5/(?i)(?:(?-i)a)b/)), 're_tests 705 (899)');
77 ok((not ("Ab" ~~ rx:P5/(?i)((?-i)a)b/)), 're_tests 706 (900)');
78 is(("aB" ~~ rx:P5/(?i)(?:(?-i)a)b/ && $/), "aB", 're_tests 707/0 (901)');
79 is(("aB" ~~ rx:P5/(?i)((?-i)a)b/ && $0), "a", 're_tests 708/1 (902)');
80 ok((not ("AB" ~~ rx:P5/(?i)(?:(?-i)a)b/)), 're_tests 709 (903)');
81 ok((not ("AB" ~~ rx:P5/(?i)((?-i)a)b/)), 're_tests 710 (904)');
82 is(("ab" ~~ rx:P5/(?i)(?-i:a)b/ && $/), "ab", 're_tests 711/0 (905)');
83 is(("ab" ~~ rx:P5/(?i)((?-i:a))b/ && $/), "ab", 're_tests 712/0 (906)');
84 is(("ab" ~~ rx:P5/(?i)((?-i:a))b/ && $0), "a", 're_tests 712/1 (907)');
85 is(("aB" ~~ rx:P5/(?i)(?-i:a)b/ && $/), "aB", 're_tests 713/0 (908)');
86 is(("aB" ~~ rx:P5/(?i)((?-i:a))b/ && $/), "aB", 're_tests 714/0 (909)');
87 is(("aB" ~~ rx:P5/(?i)((?-i:a))b/ && $0), "a", 're_tests 714/1 (910)');
88 ok((not ("Ab" ~~ rx:P5/(?i)(?-i:a)b/)), 're_tests 715 (911)');
89 ok((not ("Ab" ~~ rx:P5/(?i)((?-i:a))b/)), 're_tests 716 (912)');
90 is(("aB" ~~ rx:P5/(?i)(?-i:a)b/ && $/), "aB", 're_tests 717/0 (913)');
91 is(("aB" ~~ rx:P5/(?i)((?-i:a))b/ && $0), "a", 're_tests 718/1 (914)');
92 ok((not ("AB" ~~ rx:P5/(?i)(?-i:a)b/)), 're_tests 719 (915)');
93 ok((not ("AB" ~~ rx:P5/(?i)((?-i:a))b/)), 're_tests 720 (916)');
94 ok((not ("a\nB" ~~ rx:P5/(?i)((?-i:a.))b/)), 're_tests 721 (917)');
95 is(("a\nB" ~~ rx:P5/(?i)((?s-i:a.))b/ && $0), "a\n", 're_tests 722/1 (918)');
96 ok((not ("B\nB" ~~ rx:P5/(?i)((?s-i:a.))b/)), 're_tests 723 (919)');
97 is(("cabbbb" ~~ rx:P5/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/ && $/), "cabbbb", 're_tests 724/0 (920)');
98 is(("caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ~~ rx:P5/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/ && $/), "caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 're_tests 726/0 (922)');
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
99 #?rakudo 2 todo "(?i) and backreferences"
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
100 is(("Ab4ab" ~~ rx:P5/(?i)(ab)\d\1/ && $0), "Ab", 're_tests 728/1 (924)');
101 is(("ab4Ab" ~~ rx:P5/(?i)(ab)\d\1/ && $0), "ab", 're_tests 730/1 (926)');
102 is(("foobar1234baz" ~~ rx:P5/foo\w*\d{4}baz/ && $/), "foobar1234baz", 're_tests 732/0 (928)');
239bf2f @coke fudge for pugs
coke authored
103 #?pugs skip "PCRE hard parsefail"
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
104 #?rakudo skip "code blocks in P5 regexes NYI"
239bf2f @coke fudge for pugs
coke authored
105 is(("cabd" ~~ rx:P5/a(?{})b/ && $/), "ab", 're_tests 734/0 (930)');
106 #?pugs skip "PCRE hard parsefail"
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
107 #?rakudo skip "code blocks in P5 regexes NYI"
239bf2f @coke fudge for pugs
coke authored
108 is(("cabd" ~~ rx:P5/a(?{"\{"})b/ && $/), "ab", 're_tests 735/0 (931)');
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
109 ok(("x~~" ~~ rx:P5/x(~~)*(?:(?:F)?)?/), 're_tests 736 (932)');
110 is(("aaac" ~~ rx:P5/^a(?#xxx){3}c/ && $/), "aaac", 're_tests 738/0 (934)');
111 is(("aaac" ~~ rx:P5/(?x)^a (?#xxx) (?#yyy) {3}c/ && $/), "aaac", 're_tests 739/0 (935)');
112 ok((not ("dbcb" ~~ rx:P5/(?<![cd])b/)), 're_tests 740 (936)');
113 is(("dbaacb" ~~ rx:P5/(?<![cd])[ab]/ && $/), "a", 're_tests 742/0 (938)');
114 ok((not ("dbcb" ~~ rx:P5/(?<!(c|d))b/)), 're_tests 744 (940)');
115 is(("dbaacb" ~~ rx:P5/(?<!(c|d))[ab]/ && $/), "a", 're_tests 746/0 (942)');
116 is(("cdaccb" ~~ rx:P5/(?<!cd)[ab]/ && $/), "b", 're_tests 748/0 (944)');
289e708 @jnthn Fudge S05-modifier/perl5_5.t for Rakudo.
jnthn authored
117 #?rakudo skip "loops"
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't par...
unobe authored
118 ok((not ("a--" ~~ rx:P5/^(?:a?b?)*$/)), 're_tests 750 (946)');
119 is(("a\nb\nc\n" ~~ rx:P5/((?m)^b$)/ && $0), "b", 're_tests 752/1 (948)');
120 is(("a\nb\n" ~~ rx:P5/(?m)^b/ && $/), "b", 're_tests 753/0 (949)');
121 is(("a\nb\n" ~~ rx:P5/(?m)^(b)/ && $0), "b", 're_tests 754/1 (950)');
122 is(("a\nb\n" ~~ rx:P5/((?m)^b)/ && $0), "b", 're_tests 755/1 (951)');
123 is(("a\nb\n" ~~ rx:P5/\n((?m)^b)/ && $0), "b", 're_tests 756/1 (952)');
124 is(("a\nb\nc\n" ~~ rx:P5/((?s).)c(?!.)/ && $0), "\n", 're_tests 757/1 (953)');
125 is(("a\nb\nc\n" ~~ rx:P5/((?s)b.)c(?!.)/ && $0), "b\n", 're_tests 758/1 (954)');
126 ok((not ("a\nb\nc\n" ~~ rx:P5/^b/)), 're_tests 759 (955)');
127 ok((not ("a\nb\nc\n" ~~ rx:P5/()^b/)), 're_tests 761 (957)');
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
128
129 # vim: ft=perl6
Something went wrong with that request. Please try again.