@@ -8,30 +8,48 @@ plan 113;
8
8
# L<S03/Nonchaining binary precedence/Range object constructor>
9
9
10
10
# 3..2 must *not* produce "3 2". Use reverse to get a reversed range. -lwall
11
-
11
+ # ?niecza skip 'TODO'
12
12
is ~ (3 .. 6 ), " 3 4 5 6" , " (..) works on numbers (1)" ;
13
+ # ?niecza skip 'TODO'
13
14
is ~ (3 .. 3 ), " 3" , " (..) works on numbers (2)" ;
15
+ # ?niecza skip 'TODO'
14
16
is ~ (3 .. 2 ), " " , " (..) works on auto-rev numbers (3)" ;
17
+ # ?niecza skip 'TODO'
15
18
is ~ (8 .. 11 ), " 8 9 10 11" , " (..) works on carried numbers (3)" ;
16
19
20
+ # ?niecza skip 'TODO'
17
21
is ~ (" a" .. " c" ), " a b c" , " (..) works on chars (1)" ;
22
+ # ?niecza skip 'TODO'
18
23
is ~ (" a" .. " a" ), " a" , " (..) works on chars (2)" ;
24
+ # ?niecza skip 'TODO'
19
25
is ~ (" b" .. " a" ), " " , " (..) works on chars (3)" ;
26
+ # ?niecza skip 'TODO'
20
27
is ~ (" a" .. " z" ), " a b c d e f g h i j k l m n o p q r s t u v w x y z" , " (..) works on char range ending in z" ;
28
+ # ?niecza skip 'TODO'
21
29
is ~ (" A" .. " Z" ), " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" , " (..) works on char range ending in Z" ;
30
+ # ?niecza skip 'TODO'
22
31
is ~ (" Y" .. " AB" ), " " , " (..) works on carried chars (3)" ;
23
32
24
33
# ?rakudo 4 skip 'Spec under design here'
34
+ # ?niecza skip 'TODO'
25
35
is ~ (' Y' .. ' z' ), ' Y Z' , ' (..) works on uppercase letter .. lowercase letter (1)' ;
36
+ # ?niecza skip 'TODO'
26
37
is ~ (' z' .. ' Y' ), ' ' , ' (..) works on auto-rev uppercase letter .. lowercase letter (2)' ;
38
+ # ?niecza skip 'TODO'
27
39
is ~ (' Y' .. ' _' ), ' Y Z' , ' (..) works on letter .. non-letter (1)' ;
40
+ # ?niecza skip 'TODO'
28
41
is ~ (' _' .. ' Y' ), ' ' , ' (..) works on auto-rev letter .. non-letter (2)' ;
29
42
# ?rakudo skip "nom regression: No applicable candidates found to dispatch to for 'Numeric'."
43
+ # ?niecza skip 'TODO'
30
44
is ~ (' ' .. ' ' ), ' ' , ' all-whitespace range works' ;
31
45
46
+ # ?niecza skip 'TODO'
32
47
is ~ (3 .. 9 -3), " 3 4 5 6" , " (..) has correct precedence (1)" ;
48
+ # ?niecza skip 'TODO'
33
49
is ~ (5 .. 9 -5), " " , " (..) has correct precedence (2)" ;
50
+ # ?niecza skip 'TODO'
34
51
is ~ (2 + 1.. 6 ), " 3 4 5 6" , " (..) has correct precedence (3)" ;
52
+ # ?niecza skip 'TODO'
35
53
is ~ (2 + 5.. 6 ), " " , " (..) has correct precedence (4)" ;
36
54
37
55
# Test the three exclusive range operators:
@@ -65,12 +83,15 @@ is ['a' ^..^ 'a'], [], "double-exclusive range (x ^..^ x) where x is a char";
65
83
is 1.5 ~~ 1 ^.. ^ 2 , Bool ::True , " lazy evaluation of the range operator" ;
66
84
67
85
# Test the unary ^ operator
86
+ # ?niecza skip 'TODO'
68
87
is ~ (^ 5 ), " 0 1 2 3 4" , " unary ^num produces the range 0..^num" ;
69
88
is [^ 1 ], [0 ], " unary ^ on the boundary ^1 works" ;
70
89
is [^ 0 ], [], " unary ^0 produces null range" ;
71
90
is [^-1 ], [], " unary ^-1 produces null range" ;
72
91
is [^ 0.1 ], [0 ], " unary ^0.1 produces the range 0..^x where 0 < x < 1" ;
92
+ # ?niecza skip 'System.FormatException: Unknown char: a'
73
93
is [^ ' a' ], [], " unary ^'a' produces null range" ;
94
+ # ?niecza skip 'TODO'
74
95
is ~ (^ " 5" ), " 0 1 2 3 4" , ' unary ^"num" produces the range 0..^num' ;
75
96
76
97
{
@@ -90,6 +111,7 @@ is (<c b a> Z 1..5).join('|'), 'c|1|b|2|a|3', 'Ranges and infix:<Z>';
90
111
# two ranges
91
112
is (1 .. 6 Z ' a' .. ' c' ). join , ' 1a2b3c' , ' Ranges and infix:<Z>' ;
92
113
114
+ # ?niecza skip 'TODO'
93
115
{
94
116
# Test with floats
95
117
# 2006-12-05:
@@ -127,6 +149,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
127
149
# # remove these tests from the suite.
128
150
# RT #58018
129
151
# RT #76950
152
+ # ?niecza skip 'TODO'
130
153
{
131
154
my @ three = (1 , 1 , 1 );
132
155
my @ one = 1 ;
@@ -146,6 +169,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
146
169
is (0 .. 3 ). map ({$ _ * 2 }). join (' |' ), ' 0|2|4|6' , ' .map works on ranges' ;
147
170
is (0 .. 3 ). grep ({$ _ == 1 | 3}). join (' |' ), ' 1|3' , ' .grep works on ranges' ;
148
171
is (1 .. 3 ). first ({ $ _ % 2 == 0 }), 2 , ' .first works on ranges' ;
172
+ # ?niecza skip 'Unable to resolve method reduce in class Range'
149
173
is (1 .. 3 ). reduce ({ $ ^ a + $ ^ b }), 6 , ' .reduce works on ranges' ;
150
174
}
151
175
@@ -162,6 +186,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
162
186
is $ range . max . WHAT . gist , " Str()" , ' range end is a string' ;
163
187
lives_ok { " $ range" }, ' can stringify range' ;
164
188
# ?rakudo skip "nom regression: No applicable candidates found to dispatch to for 'Numeric'."
189
+ # ?niecza skip 'TODO'
165
190
is ~ $ range , " 100.B 101.B 102.B" , ' range is correct' ;
166
191
}
167
192
@@ -174,6 +199,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
174
199
is $ range . max , 3 , ' range ends at three' ;
175
200
# ?rakudo 2 skip "range stringification: Method 'succ' not found for invocant of class 'Match'"
176
201
lives_ok { " $ range" }, ' can stringify range' ;
202
+ # ?niecza skip 'TODO'
177
203
is ~ $ range , " 1 2 3" , ' range is correct' ;
178
204
}
179
205
# and another set, just for the lulz
@@ -182,6 +208,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
182
208
ok ' 1 3' ~~ /(\d ) . (\d ) /, ' regex sanity' ;
183
209
isa_ok $0 .. $1 , Range , ' $0..$1 constructs a Range' ;
184
210
# ?rakudo skip "range with match object endpoints: Method 'succ' not found for invocant of class 'Match'"
211
+ # ?niecza skip 'cannot increment a value of type Match'
185
212
is ($0 .. $1 ). join (' |' ), ' 1|2|3' , ' range from $0..$1' ;
186
213
}
187
214
{
@@ -191,6 +218,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
191
218
is $ range . min , 1 , ' range starts at one' ;
192
219
is $ range . max , 3 , ' range ends at three' ;
193
220
lives_ok { " $ range" }, ' can stringify range' ;
221
+ # ?niecza skip 'TODO'
194
222
is ~ $ range , " 1 2 3" , ' range is correct' ;
195
223
}
196
224
{
@@ -202,13 +230,15 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
202
230
is $ range . max , 3 , ' range ends at three' ;
203
231
is $ range . max . WHAT . gist , " Str()" , ' range end is a string' ;
204
232
lives_ok { " $ range" }, ' can stringify range' ;
233
+ # ?niecza skip 'TODO'
205
234
is ~ $ range , " 1 2 3" , ' range is correct' ;
206
235
}
207
236
208
237
# L<S03/Nonchaining binary precedence/it is illegal to use a Range or a
209
238
# List as implicitly numeric:>
210
239
211
240
# ?rakudo todo 'forbid Ranges and Lists as Range endpoints'
241
+ # ?niecza skip 'TODO'
212
242
{
213
243
ok ! defined (try { 0 .. ^ 10 }), ' 0 .. ^10 is illegal' ;
214
244
ok ! defined (try { 0 .. (0 , 1 , 2 ) }), ' 0 .. List is illegal' ;
@@ -223,6 +253,7 @@ is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
223
253
224
254
# RT #82620
225
255
# ?rakudo todo "range leaking Parrot types: Method 'trans' not found for invocant of class 'Str'"
256
+ # ?niecza skip 'TODO'
226
257
{
227
258
lives_ok {(" a" .. " b" ). map ({. trans (" " => " " )}). perl },
228
259
" range doesn't leak Parrot types" ;
0 commit comments