Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 299 lines (259 sloc) 11.493 kb
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
1 use v6;
2
3 use Test;
4
0093451 @moritz RT #77572, infix .. is not associative
moritz authored
5 plan 120;
7f76022 [t/spec] forbid lists and ranges as Range end points (as per r28171)
moritz authored
6
7
8 # L<S03/Nonchaining binary precedence/Range object constructor>
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
9
10 # 3..2 must *not* produce "3 2". Use reverse to get a reversed range. -lwall
11 is ~(3..6), "3 4 5 6", "(..) works on numbers (1)";
12 is ~(3..3), "3", "(..) works on numbers (2)";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
13 is ~(3..2), "", "(..) works on auto-rev numbers (3)";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
14 is ~(8..11), "8 9 10 11", "(..) works on carried numbers (3)";
15
16 is ~("a".."c"), "a b c", "(..) works on chars (1)";
17 is ~("a".."a"), "a", "(..) works on chars (2)";
18 is ~("b".."a"), "", "(..) works on chars (3)";
b5ee073 [t/spec] Unfudge series / Range tests Rakudo now passes, and add a few m...
colomon authored
19 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";
20 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";
7f7b55a @coke pugs fudge
coke authored
21 #?pugs todo
2bb1c63 [t/spec] Refudge to work with list branch.
colomon authored
22 is ~("Y".."AB"), "", "(..) works on carried chars (3)";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
23
2bb1c63 [t/spec] Refudge to work with list branch.
colomon authored
24 #?rakudo 4 skip 'Spec under design here'
2311165 @colomon Refudge for niecza.
colomon authored
25 #?niecza 4 skip 'Spec under design here'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
26 is ~('Y'..'z'), 'Y Z', '(..) works on uppercase letter .. lowercase letter (1)';
27 is ~('z'..'Y'), '', '(..) works on auto-rev uppercase letter .. lowercase letter (2)';
28 is ~('Y'..'_'), 'Y Z', '(..) works on letter .. non-letter (1)';
29 is ~('_'..'Y'), '', '(..) works on auto-rev letter .. non-letter (2)';
3da5e46 [t/spec] test for RT #76226, all-whitespace range
moritz authored
30 is ~(' '..' '), ' ', 'all-whitespace range works';
31
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
32 is ~(3..9-3), "3 4 5 6", "(..) has correct precedence (1)";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
33 is ~(5..9-5), "", "(..) has correct precedence (2)";
34 is ~(2+1..6), "3 4 5 6", "(..) has correct precedence (3)";
35 is ~(2+5..6), "", "(..) has correct precedence (4)";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
36
37 # Test the three exclusive range operators:
832f178 [t/spec] fix more smartlinks; down to 33 broken links
moritz authored
38 # L<S03/Range and RangeIter semantics/range operator has variants>
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
39 is [1^..9], [2..9], "bottom-exclusive range (^..) works (1)";
40 is [2^..2], [], "bottom-exclusive range (^..) works (2)";
7f7b55a @coke pugs fudge
coke authored
41 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
42 is [3^..2], [], "bottom-exclusive auto-rev range (^..) works (3)";
43 is [1 ..^9], [1..8], "top-exclusive range (..^) works (1)";
44 is [2 ..^2], [], "top-exclusive range (..^) works (2)";
45 is [3 ..^2], [], "top-exclusive auto-rev range (..^) works (3)";
46 is [1^..^9], [2..8], "double-exclusive range (^..^) works (1)";
7f7b55a @coke pugs fudge
coke authored
47 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
48 is [9^..^1], [], "double-exclusive auto-rev range (^..^) works (2)";
49 is [1^..^2], [], "double-exclusive range (^..^) can produce null range (1)";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
50
51 # tests of (x ^..^ x) here and below ensure that our implementation
52 # of double-exclusive range does not blindly remove an element
53 # from the head and tail of a list
54 is [1^..^1], [], "double-exclusive range (x ^..^ x) where x is an int";
55
56 is ["a"^.."z"], ["b".."z"], "bottom-exclusive string range (^..) works";
7f7b55a @coke pugs fudge
coke authored
57 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
58 is ["z"^.."a"], [], "bottom-exclusive string auto-rev range (^..) works";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
59 is ["a"..^"z"], ["a".."y"], "top-exclusive string range (..^) works";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
60 is ["z"..^"a"], [], "top-exclusive string auto-rev range (..^) works";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
61 is ["a"^..^"z"], ["b".."y"], "double-exclusive string range (^..^) works";
7f7b55a @coke pugs fudge
coke authored
62 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
63 is ["z"^..^"a"], [], "double-exclusive string auto-rev range (^..^) works";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
64 is ['a'^..^'b'], [], "double-exclusive string range (^..^) can produce null range";
7f7b55a @coke pugs fudge
coke authored
65 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
66 is ['b'^..^'a'], [], "double-exclusive string auto-rev range (^..^) can produce null range";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
67 is ['a' ^..^ 'a'], [], "double-exclusive range (x ^..^ x) where x is a char";
5fb50bc @moritz test "a".."z", RT #95692
moritz authored
68 is ('a'..'z').list.join(' '), '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', '"a".."z"';
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
69
ba8e84a [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
70 #?pugs todo 'bug'
71 is 1.5 ~~ 1^..^2, Bool::True, "lazy evaluation of the range operator";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
72
73 # Test the unary ^ operator
74 is ~(^5), "0 1 2 3 4", "unary ^num produces the range 0..^num";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
75 is [^1], [0], "unary ^ on the boundary ^1 works";
76 is [^0], [], "unary ^0 produces null range";
77 is [^-1], [], "unary ^-1 produces null range";
78 is [^0.1], [0], "unary ^0.1 produces the range 0..^x where 0 < x < 1";
64b5bba [t/spec] Refudge a tad, add a couple of tests to make sure prefix:<^> nu...
colomon authored
79 is ~(^"5"), "0 1 2 3 4", 'unary ^"num" produces the range 0..^num';
80
81 {
82 my @a = 3, 5, 3;
7f7b55a @coke pugs fudge
coke authored
83 #?pugs todo
64b5bba [t/spec] Refudge a tad, add a couple of tests to make sure prefix:<^> nu...
colomon authored
84 is (^@a).perl, (0..^3).perl, 'unary ^@a produces 0..^+@a';
85 }
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
86
b5ee073 [t/spec] Unfudge series / Range tests Rakudo now passes, and add a few m...
colomon authored
87 # test iterating on infinite ranges
88 is (1..*).[^5].join('|'), '1|2|3|4|5', '1..*';
89 is ('a'..*).[^5].join('|'), 'a|b|c|d|e', '"a"..*';
90
e8dc6d6 [t/spec] regression tests for RT #60898 (ranges + infix:<Z>)
moritz authored
91 # test that the zip operator works with ranges
7f7b55a @coke pugs fudge
coke authored
92 #?pugs 4 todo
e8dc6d6 [t/spec] regression tests for RT #60898 (ranges + infix:<Z>)
moritz authored
93 is (1..5 Z <a b c>).join('|'), '1|a|2|b|3|c', 'Ranges and infix:<Z>';
94 is (1..2 Z <a b c>).join('|'), '1|a|2|b', 'Ranges and infix:<Z>';
95 is (<c b a> Z 1..5).join('|'), 'c|1|b|2|a|3', 'Ranges and infix:<Z>';
96
97 # two ranges
49d046f .join now defaults to ''
lwall authored
98 is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
e8dc6d6 [t/spec] regression tests for RT #60898 (ranges + infix:<Z>)
moritz authored
99
ba2d31c [spec] fudged and corrected range.t
moritz authored
100 {
101 # Test with floats
102 # 2006-12-05:
103 # 16:16 <TimToady> ~(1.9 ^..^ 4.9) should produce 2.9, 3.9
104 # 16:17 <pmichaud> and ~(1.9 ^..^ 4.5) would produce the same?
105 # 16:17 <TimToady> yes
106 is ~(1.1 .. 4) , "1.1 2.1 3.1", "range with float .min";
107 is ~(1.9 .. 4) , "1.9 2.9 3.9", "range with float .min";
108 is ~(1.1 ^.. 4), "2.1 3.1" , "bottom exclusive range of float";
109 is ~(1.9 ^.. 4), "2.9 3.9" , "bottom exclusive range of float";
110
111 is ~(1 .. 4.1) , "1 2 3 4", "range with float .max";
112 is ~(1 .. 4.9) , "1 2 3 4", "range with float .max";
113 is ~(1 ..^ 4.1), "1 2 3 4", "top exclusive range of float";
114 is ~(1 ..^ 4.9), "1 2 3 4", "top exclusive range of float";
115
116 is ~(1.1 .. 4.1), "1.1 2.1 3.1 4.1", "range with float .min/.max";
117 is ~(1.9 .. 4.1), "1.9 2.9 3.9" , "range with float .min/.max";
118 is ~(1.1 .. 4.9), "1.1 2.1 3.1 4.1", "range with float .min/.max";
119 is ~(1.9 .. 4.9), "1.9 2.9 3.9 4.9", "range with float .min/.max";
120
121 is ~(1.1 ^..^ 4.1), "2.1 3.1" , "both exclusive float range";
122 is ~(1.9 ^..^ 4.1), "2.9 3.9" , "both exclusive float range";
123 is ~(1.1 ^..^ 4.9), "2.1 3.1 4.1", "both exclusive float range";
124 is ~(1.9 ^..^ 4.9), "2.9 3.9" , "both exclusive float range";
125 is [1.1 ^..^ 1.1], [], "double-exclusive range (x ^..^ x) where x is a float";
126 }
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
127
128 # Test that the operands are forced to scalar context
748e055 S03-operators/range.t: Add note about use of @array as arguments to inf...
pmichaud authored
129 ## From pmichaud 2006-06-30: These tests may be incorrect.
130 ## C<@one> in ## item context returns an Array, not a number
131 ## -- use C< +@one > to get the number of elements. So, we
132 ## need to either declare that there's a version of infix:<..>
133 ## that coerces its arguments to numeric context, or we can
134 ## remove these tests from the suite.
ffc88f9 [t/spec] add RT #58018 marker to tests in range.t
moritz authored
135 # RT #58018
d37e5d1 [range.t] Marked tests for RT #76950.
Kodi Arfer authored
136 # RT #76950
2311165 @colomon Refudge for niecza.
colomon authored
137 #?niecza skip "Unhandled exception: cannot increment a value of type Array"
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
138 {
139 my @three = (1, 1, 1);
f07dd23 [t/spec] a test for Range.map
moritz authored
140 my @one = 1;
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
141
bb1b10f (un)fudge range.t
kboga authored
142 #?rakudo 2 skip "nom regression: Method 'succ' not found for invocant of class 'Array'"
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
143 is ~(@one .. 3) , "1 2 3", "lower inclusive limit is in scalar context";
144 is ~(@one ^.. 3) , "2 3" , "lower exclusive limit is in scalar context";
7f7b55a @coke pugs fudge
coke authored
145 #?pugs skip 'empty list'
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
146 is ~(3 ^.. @one) , "" , "lower exclusive limit is in scalar context";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
147 is ~(1 .. @three) , "1 2 3", "upper inclusive limit is in scalar context";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
148 is ~(4 .. @three) , "" , "upper inclusive limit is in scalar context";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
149 is ~(1 ..^ @three) , "1 2" , "upper exclusive limit is in scalar context";
a971e66 [pugs_s02,s03] moved the auto-reversing range tests to the S03-operators...
s1n authored
150 is ~(4 ..^ @three) , "" , "upper exclusive limit is in scalar context";
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and ra...
Auzon authored
151 }
152
3f4b761 [t/spec] test for .grep on Range, and unfudge Range.map test
moritz authored
153 # test that .map and .grep work on ranges
f07dd23 [t/spec] a test for Range.map
moritz authored
154 {
3f4b761 [t/spec] test for .grep on Range, and unfudge Range.map test
moritz authored
155 is (0..3).map({$_ * 2}).join('|'), '0|2|4|6', '.map works on ranges';
156 is (0..3).grep({$_ == 1|3}).join('|'), '1|3', '.grep works on ranges';
b0e0a3a [t/spec] test that .first and .reduce work on ranges
moritz authored
157 is (1..3).first({ $_ % 2 == 0}), 2, '.first works on ranges';
158 is (1..3).reduce({ $^a + $^b}), 6, '.reduce works on ranges';
f07dd23 [t/spec] a test for Range.map
moritz authored
159 }
160
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
161 # test that range operands are handled in string context if strings
162 {
163 my $range;
164 my $start = "100.B";
165 my $end = "102.B";
166 lives_ok { $range = $start..$end },
167 'can make range from numeric string vars';
7f7b55a @coke pugs fudge
coke authored
168 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
169 is $range.min, $start, 'range starts at start';
ede6fd4 @coke pugs refudge (for "gist")
coke authored
170 #?pugs todo "wrong type"
171 is $range.min.WHAT.gist, Str.gist, 'range start is a string';
7f7b55a @coke pugs fudge
coke authored
172 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
173 is $range.max, $end, 'range ends at end';
ede6fd4 @coke pugs refudge (for "gist")
coke authored
174 #?pugs todo "wrong type"
175 is $range.max.WHAT.gist, Str.gist, 'range end is a string';
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
176 lives_ok { "$range" }, 'can stringify range';
7f7b55a @coke pugs fudge
coke authored
177 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
178 is ~$range, "100.B 101.B 102.B", 'range is correct';
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
179 }
0a84065 [t/spec] Fudge for ng.
colomon authored
180
b390af6 Tag test with RT number.
colomon authored
181 # RT #67882
82915ee [t/spec] Test bug from colomon++
kyle authored
182 {
183 my $range;
184 lives_ok { '1 3' ~~ /(\d+) \s (\d+)/; $range = $0..$1 },
185 'can make range from match vars';
7f7b55a @coke pugs fudge
coke authored
186 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
187 is $range.min, 1, 'range starts at one';
7f7b55a @coke pugs fudge
coke authored
188 #?pugs todo
bb1b10f (un)fudge range.t
kboga authored
189 is $range.max, 3, 'range ends at three';
190 #?rakudo 2 skip "range stringification: Method 'succ' not found for invocant of class 'Match'"
2311165 @colomon Refudge for niecza.
colomon authored
191 #?niecza 2 skip 'cannot increment a value of type Match'
82915ee [t/spec] Test bug from colomon++
kyle authored
192 lives_ok { "$range" }, 'can stringify range';
7f7b55a @coke pugs fudge
coke authored
193 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
194 is ~$range, "1 2 3", 'range is correct';
82915ee [t/spec] Test bug from colomon++
kyle authored
195 }
0877354 [t/spec] unfudge tests for RT #67882, and add a few more (because I did ...
moritz authored
196 # and another set, just for the lulz
197 # RT #67882
7f7b55a @coke pugs fudge
coke authored
198 #?pugs skip 'Range'
0877354 [t/spec] unfudge tests for RT #67882, and add a few more (because I did ...
moritz authored
199 {
200 ok '1 3' ~~ /(\d) . (\d)/, 'regex sanity';
201 isa_ok $0..$1, Range, '$0..$1 constructs a Range';
bb1b10f (un)fudge range.t
kboga authored
202 #?rakudo skip "range with match object endpoints: Method 'succ' not found for invocant of class 'Match'"
d0e149b @coke niecza fudging
coke authored
203 #?niecza skip 'cannot increment a value of type Match'
0877354 [t/spec] unfudge tests for RT #67882, and add a few more (because I did ...
moritz authored
204 is ($0..$1).join('|'), '1|2|3', 'range from $0..$1';
205 }
7f7b55a @coke pugs fudge
coke authored
206
82915ee [t/spec] Test bug from colomon++
kyle authored
207 {
208 my $range;
209 lives_ok { '1 3' ~~ /(\d+) \s (\d+)/; $range = +$0..+$1 },
210 'can make range from match vars with numeric context forced';
7f7b55a @coke pugs fudge
coke authored
211 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
212 is $range.min, 1, 'range starts at one';
7f7b55a @coke pugs fudge
coke authored
213 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
214 is $range.max, 3, 'range ends at three';
82915ee [t/spec] Test bug from colomon++
kyle authored
215 lives_ok { "$range" }, 'can stringify range';
7f7b55a @coke pugs fudge
coke authored
216 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
217 is ~$range, "1 2 3", 'range is correct';
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
218 }
7f7b55a @coke pugs fudge
coke authored
219
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
220 {
221 my $range;
222 lives_ok { '1 3' ~~ /(\d+) \s (\d+)/; $range = ~$0..~$1 },
223 'can make range from match vars with string context forced';
7f7b55a @coke pugs fudge
coke authored
224 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
225 is $range.min, 1, 'range starts at one';
ede6fd4 @coke pugs refudge (for "gist")
coke authored
226 #?pugs todo 'wrong type'
227 is $range.min.WHAT.gist, Str.gist, 'range start is a string';
7f7b55a @coke pugs fudge
coke authored
228 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
229 is $range.max, 3, 'range ends at three';
ede6fd4 @coke pugs refudge (for "gist")
coke authored
230 #?pugs todo 'wrong type'
231 is $range.max.WHAT.gist, Str.gist, 'range end is a string';
d4459dc Add another range test case around the match operator, and an equivalent...
colomon authored
232 lives_ok { "$range" }, 'can stringify range';
7f7b55a @coke pugs fudge
coke authored
233 #?pugs todo
0a84065 [t/spec] Fudge for ng.
colomon authored
234 is ~$range, "1 2 3", 'range is correct';
82915ee [t/spec] Test bug from colomon++
kyle authored
235 }
236
01d1162 @pmichaud Update spectests for Range endpoint exceptions.
pmichaud authored
237 # L<S03/Nonchaining binary precedence/it is illegal to use a Range as
238 # implicity numeric>
7f76022 [t/spec] forbid lists and ranges as Range end points (as per r28171)
moritz authored
239
01d1162 @pmichaud Update spectests for Range endpoint exceptions.
pmichaud authored
240 #?niecza todo 'forbid Ranges as Range endpoints'
7f7b55a @coke pugs fudge
coke authored
241 #?pugs todo
7f76022 [t/spec] forbid lists and ranges as Range end points (as per r28171)
moritz authored
242 {
243 ok !defined(try { 0 .. ^10 }), '0 .. ^10 is illegal';
244 }
245
01d1162 @pmichaud Update spectests for Range endpoint exceptions.
pmichaud authored
246 # Lists are allowed on the rhs if the lhs is numeric (Real):
247 #?niecza todo 'allow List as rhs endpoint'
248 #?pugs todo
249 is ~(2 .. [<a b c d e>]), "2 3 4 5", '2 .. @list is legal';
250
7509d77 [t/spec] tests for RT #68788 segmentation fault on the "say 1..{$_}"
bbkr authored
251 # RT #68788
7f7b55a @coke pugs fudge
coke authored
252 #?pugs skip 'Missing required parameters: $_'
253 #?DOES 2
7509d77 [t/spec] tests for RT #68788 segmentation fault on the "say 1..{$_}"
bbkr authored
254 {
255 $_ = Any; # unsetting $_ to reproduce bug literally
256 lives_ok {(1..$_)}, '(1..$_) lives';
257 isa_ok (1..$_), Range, '(..) works on Int .. Any';
258 }
0877354 [t/spec] unfudge tests for RT #67882, and add a few more (because I did ...
moritz authored
259
7f7b55a @coke pugs fudge
coke authored
260 #?pugs skip 'Numeric'
35ebf63 @colomon Add tests for string and array RHS of numeric ranges.
colomon authored
261 {
262 my $range = 1 .. '10';
263 is +$range, 10, "1 .. '10' has ten elements in it";
264 is +$range.grep(Numeric), 10, "and they are all numbers";
265 }
266
7f7b55a @coke pugs fudge
coke authored
267 #?pugs skip 'Numeric'
35ebf63 @colomon Add tests for string and array RHS of numeric ranges.
colomon authored
268 {
269 my @array = 1 .. 10;
270 my $range = 1 .. @array;
271 is +$range, 10, "1 .. @array has ten elements in it";
272 is +$range.grep(Numeric), 10, "and they are all numbers";
273 }
274
b2c7760 @felliott [range.t] add test for RT #82620 (range exposing Parrot types)
felliott authored
275 # RT #82620
276 {
277 lives_ok {("a".."b").map({.trans(""=>"")}).perl},
278 "range doesn't leak Parrot types";
279 }
280
53c3cd2 @moritz test ranges of bigints and nums
moritz authored
281 {
282 my $big = 2 ** 130;
283 my $count = 0;
284 ++$count for $big .. $big + 2;
285 is $count, 3, 'can iterate over big Int range';
286 }
287
288 # RT #110350
289 {
290 for 1e0 .. 1e0 {
291 isa_ok $_, Num, 'Range of nums produces a Num';
292 }
293 }
294
0093451 @moritz RT #77572, infix .. is not associative
moritz authored
295 # RT #77572
296 eval_dies_ok '1..2..3', '.. is not associative';
297
7f7b55a @coke pugs fudge
coke authored
298 # vim: ft=perl6
Something went wrong with that request. Please try again.