Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 118 lines (111 sloc) 6.301 kB
808f7c2 [t/spec] S05 - Moved P5/Perl5 modifier tests into spec (rakudo can't …
unobe authored
1 use v6;
2
3 use Test;
4
5 plan 100;
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(("abc" ~~ rx:P5/abc/ && $/), "abc", 're_tests 1/0 (1)');
19 is(("abc" ~~ rx:P5/abc/ && $/.from), 0, 're_tests 1/0 (2)');
20 ok((not ("xbc" ~~ rx:P5/abc/)), 're_tests 3 (5)');
21 ok((not ("axc" ~~ rx:P5/abc/)), 're_tests 5 (7)');
22 ok((not ("abx" ~~ rx:P5/abc/)), 're_tests 7 (9)');
23 is(("xabcy" ~~ rx:P5/abc/ && $/), "abc", 're_tests 9/0 (11)');
24 is(("xabcy" ~~ rx:P5/abc/ && $/.from), 1, 're_tests 9/0 (12)');
25 is(("ababc" ~~ rx:P5/abc/ && $/), "abc", 're_tests 11/0 (15)');
26 is(("ababc" ~~ rx:P5/abc/ && $/.from), 2, 're_tests 11/0 (16)');
27 is(("abc" ~~ rx:P5/ab*c/ && $/), "abc", 're_tests 13/0 (19)');
28 is(("abc" ~~ rx:P5/ab*c/ && $/.from), 0, 're_tests 13/0 (20)');
29 is(("abc" ~~ rx:P5/ab*bc/ && $/), "abc", 're_tests 15/0 (23)');
30 is(("abc" ~~ rx:P5/ab*bc/ && $/.from), 0, 're_tests 15/0 (24)');
31 is(("abbc" ~~ rx:P5/ab*bc/ && $/), "abbc", 're_tests 17/0 (27)');
32 is(("abbc" ~~ rx:P5/ab*bc/ && $/.from), 0, 're_tests 17/0 (28)');
33 is(("abbbbc" ~~ rx:P5/ab*bc/ && $/), "abbbbc", 're_tests 19/0 (31)');
34 is(("abbbbc" ~~ rx:P5/ab*bc/ && $/.from), 0, 're_tests 19/0 (32)');
35 is(("abbbbc" ~~ rx:P5/.{1}/ && $/), "a", 're_tests 21/0 (35)');
36 is(("abbbbc" ~~ rx:P5/.{1}/ && $/.from), 0, 're_tests 21/0 (36)');
37 is(("abbbbc" ~~ rx:P5/.{3,4}/ && $/), "abbb", 're_tests 23/0 (39)');
38 is(("abbbbc" ~~ rx:P5/.{3,4}/ && $/.from), 0, 're_tests 23/0 (40)');
39 is(("abbbbc" ~~ rx:P5/ab{0,}bc/ && $/), "abbbbc", 're_tests 25/0 (43)');
40 is(("abbbbc" ~~ rx:P5/ab{0,}bc/ && $/.from), 0, 're_tests 25/0 (44)');
41 is(("abbc" ~~ rx:P5/ab+bc/ && $/), "abbc", 're_tests 27/0 (47)');
42 is(("abbc" ~~ rx:P5/ab+bc/ && $/.from), 0, 're_tests 27/0 (48)');
43 ok((not ("abc" ~~ rx:P5/ab+bc/)), 're_tests 29 (51)');
44 ok((not ("abq" ~~ rx:P5/ab+bc/)), 're_tests 31 (53)');
45 ok((not ("abq" ~~ rx:P5/ab{1,}bc/)), 're_tests 33 (55)');
46 is(("abbbbc" ~~ rx:P5/ab+bc/ && $/), "abbbbc", 're_tests 35/0 (57)');
47 is(("abbbbc" ~~ rx:P5/ab+bc/ && $/.from), 0, 're_tests 35/0 (58)');
48 is(("abbbbc" ~~ rx:P5/ab{1,}bc/ && $/), "abbbbc", 're_tests 37/0 (61)');
49 is(("abbbbc" ~~ rx:P5/ab{1,}bc/ && $/.from), 0, 're_tests 37/0 (62)');
50 is(("abbbbc" ~~ rx:P5/ab{1,3}bc/ && $/), "abbbbc", 're_tests 39/0 (65)');
51 is(("abbbbc" ~~ rx:P5/ab{1,3}bc/ && $/.from), 0, 're_tests 39/0 (66)');
52 is(("abbbbc" ~~ rx:P5/ab{3,4}bc/ && $/), "abbbbc", 're_tests 41/0 (69)');
53 is(("abbbbc" ~~ rx:P5/ab{3,4}bc/ && $/.from), 0, 're_tests 41/0 (70)');
54 ok((not ("abbbbc" ~~ rx:P5/ab{4,5}bc/)), 're_tests 43 (73)');
55 is(("abbc" ~~ rx:P5/ab?bc/ && $/), "abbc", 're_tests 45/0 (75)');
56 is(("abc" ~~ rx:P5/ab?bc/ && $/), "abc", 're_tests 47/0 (77)');
57 is(("abc" ~~ rx:P5/ab{0,1}bc/ && $/), "abc", 're_tests 49/0 (79)');
58 ok((not ("abbbbc" ~~ rx:P5/ab?bc/)), 're_tests 51 (81)');
59 is(("abc" ~~ rx:P5/ab?c/ && $/), "abc", 're_tests 53/0 (83)');
60 is(("abc" ~~ rx:P5/ab{0,1}c/ && $/), "abc", 're_tests 55/0 (85)');
61 is(("abc" ~~ rx:P5/^abc$/ && $/), "abc", 're_tests 57/0 (87)');
62 ok((not ("abcc" ~~ rx:P5/^abc$/)), 're_tests 59 (89)');
63 is(("abcc" ~~ rx:P5/^abc/ && $/), "abc", 're_tests 61/0 (91)');
64 ok((not ("aabc" ~~ rx:P5/^abc$/)), 're_tests 63 (93)');
65 is(("aabc" ~~ rx:P5/abc$/ && $/), "abc", 're_tests 65/0 (95)');
66 ok((not ("aabcd" ~~ rx:P5/abc$/)), 're_tests 67 (97)');
67 is(("abc" ~~ rx:P5/^/ && $/), "", 're_tests 69/0 (99)');
68 is(("abc" ~~ rx:P5/$/ && $/), "", 're_tests 71/0 (101)');
69 is(("abc" ~~ rx:P5/a.c/ && $/), "abc", 're_tests 73/0 (103)');
70 is(("axc" ~~ rx:P5/a.c/ && $/), "axc", 're_tests 75/0 (105)');
71 is(("axyzc" ~~ rx:P5/a.*c/ && $/), "axyzc", 're_tests 77/0 (107)');
72 ok((not ("axyzd" ~~ rx:P5/a.*c/)), 're_tests 79 (109)');
73 ok((not ("abc" ~~ rx:P5/a[bc]d/)), 're_tests 81 (111)');
74 is(("abd" ~~ rx:P5/a[bc]d/ && $/), "abd", 're_tests 83/0 (113)');
75 ok((not ("abd" ~~ rx:P5/a[b-d]e/)), 're_tests 85 (115)');
76 is(("ace" ~~ rx:P5/a[b-d]e/ && $/), "ace", 're_tests 87/0 (117)');
77 is(("aac" ~~ rx:P5/a[b-d]/ && $/), "ac", 're_tests 89/0 (119)');
78 is(("a-" ~~ rx:P5/a[-b]/ && $/), "a-", 're_tests 91/0 (121)');
79 is(("a-" ~~ rx:P5/a[b-]/ && $/), "a-", 're_tests 93/0 (123)');
80 is(("a]" ~~ rx:P5/a]/ && $/), "a]", 're_tests 95/0 (125)');
81 is(("a]b" ~~ rx:P5/a[]]b/ && $/), "a]b", 're_tests 97/0 (127)');
82 is(("aed" ~~ rx:P5/a[^bc]d/ && $/), "aed", 're_tests 99/0 (129)');
83 ok((not ("abd" ~~ rx:P5/a[^bc]d/)), 're_tests 101 (131)');
84 is(("adc" ~~ rx:P5/a[^-b]c/ && $/), "adc", 're_tests 103/0 (133)');
85 ok((not ("a-c" ~~ rx:P5/a[^-b]c/)), 're_tests 105 (135)');
86 ok((not ("a]c" ~~ rx:P5/a[^]b]c/)), 're_tests 107 (137)');
87 is(("adc" ~~ rx:P5/a[^]b]c/ && $/), "adc", 're_tests 109/0 (139)');
88 ok(("a-" ~~ rx:P5/\ba\b/), 're_tests 111 (141)');
89 ok(("-a" ~~ rx:P5/\ba\b/), 're_tests 113 (143)');
90 ok(("-a-" ~~ rx:P5/\ba\b/), 're_tests 115 (145)');
91 ok((not ("xy" ~~ rx:P5/\by\b/)), 're_tests 117 (147)');
92 ok((not ("yz" ~~ rx:P5/\by\b/)), 're_tests 119 (149)');
93 ok((not ("xyz" ~~ rx:P5/\by\b/)), 're_tests 121 (151)');
94 ok((not ("a-" ~~ rx:P5/\Ba\B/)), 're_tests 123 (153)');
95 ok((not ("-a" ~~ rx:P5/\Ba\B/)), 're_tests 125 (155)');
96 ok((not ("-a-" ~~ rx:P5/\Ba\B/)), 're_tests 127 (157)');
97 ok(("xy" ~~ rx:P5/\By\b/), 're_tests 129 (159)');
98 is(("xy" ~~ rx:P5/\By\b/ && $/.from), 1, 're_tests 131/0 (161)');
99 ok(("xy" ~~ rx:P5/\By\b/), 're_tests 133 (163)');
100 ok(("yz" ~~ rx:P5/\by\B/), 're_tests 135 (165)');
101 ok(("xyz" ~~ rx:P5/\By\B/), 're_tests 137 (167)');
102 ok(("a" ~~ rx:P5/\w/), 're_tests 139 (169)');
103 ok((not ("-" ~~ rx:P5/\w/)), 're_tests 141 (171)');
104 ok((not ("a" ~~ rx:P5/\W/)), 're_tests 143 (173)');
105 ok(("-" ~~ rx:P5/\W/), 're_tests 145 (175)');
106 ok(("a b" ~~ rx:P5/a\sb/), 're_tests 147 (177)');
107 ok((not ("a-b" ~~ rx:P5/a\sb/)), 're_tests 149 (179)');
108 ok((not ("a b" ~~ rx:P5/a\Sb/)), 're_tests 151 (181)');
109 ok(("a-b" ~~ rx:P5/a\Sb/), 're_tests 153 (183)');
110 ok(("1" ~~ rx:P5/\d/), 're_tests 155 (185)');
111 ok((not ("-" ~~ rx:P5/\d/)), 're_tests 157 (187)');
112 ok((not ("1" ~~ rx:P5/\D/)), 're_tests 159 (189)');
113 ok(("-" ~~ rx:P5/\D/), 're_tests 161 (191)');
114 ok(("a" ~~ rx:P5/[\w]/), 're_tests 163 (193)');
115 ok((not ("-" ~~ rx:P5/[\w]/)), 're_tests 165 (195)');
116 ok((not ("a" ~~ rx:P5/[\W]/)), 're_tests 167 (197)');
117 ok(("-" ~~ rx:P5/[\W]/), 're_tests 169 (199)');
Something went wrong with that request. Please try again.