Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 493 lines (398 sloc) 10.377 kb
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
1 use v6;
2
db4bde79 »
2010-03-13 [t/spec] add 'use MONKEY_TYPING' where appropriate
3 use MONKEY_TYPING;
4
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
5 use Test;
6
7 =begin description
8
9 Tests the "for" statement
10
11 This attempts to test as many variations of the
12 for statement as possible
13
14 =end description
15
d2482f41 »
2010-08-22 replace plan *; with number of tests S03-S06
16 plan 65;
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
17
18 ## No foreach
19 # L<S04/The C<for> statement/"no foreach statement any more">
20 {
21 my $times_run = 0;
22 eval_dies_ok 'foreach 1..10 { $times_run++ }; 1', "foreach is gone";
23 eval_dies_ok 'foreach (1..10) { $times_run++}; 1',
24 "foreach is gone, even with parens";
25 is $times_run, 0, "foreach doesn't work";
26 }
27
28 ## for with plain old range operator w/out parens
29
30 {
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
31 my $a = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
32 for 0 .. 5 { $a = $a ~ $_; };
33 is($a, '012345', 'for 0..5 {} works');
34 }
35
36 # ... with pointy blocks
37
38 {
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
39 my $b = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
40 for 0 .. 5 -> $_ { $b = $b ~ $_; };
41 is($b, '012345', 'for 0 .. 5 -> {} works');
42 }
43
44 #?pugs eval 'todo: slice context'
4837029d »
2008-07-03 [spec] fudged for.t. Fails with 'Null PMC access in type()'
45 #?rakudo skip 'slice context'
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
46 #?niecza skip 'slice context'
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
47 {
48 my $str;
49 my @a = 1..3;
50 my @b = 5..6;
51 for zip(@a; @b) -> $x, $y {
52 $str ~= "($x $y)";
53 }
54 is $str, "(1 5)(2 4)(3 6)", 'for zip(@a; @b) -> $x, $y works';
55 }
56
57 # ... with referential sub
58 {
1888ab6f »
2011-01-22 [for.t] fix and unfudge test that was failing due to range bug
59 my $d = "";
60 for -2 .. 2 { $d ~= .sign };
61 is($d, '-1-1011', 'for 0 .. 5 { .some_sub } works');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
62 }
63
64 ## and now with parens around the range operator
65 {
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
66 my $e = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
67 for (0 .. 5) { $e = $e ~ $_; };
68 is($e, '012345', 'for () {} works');
69 }
70
71 # ... with pointy blocks
72 {
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
73 my $f = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
74 for (0 .. 5) -> $_ { $f = $f ~ $_; };
75 is($f, '012345', 'for () -> {} works');
76 }
77
78 # ... with implicit topic
79
80 {
81 $_ = "GLOBAL VALUE";
82 for "INNER VALUE" {
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
83 is( .lc, "inner value", "Implicit default topic is seen by lc()");
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
84 };
85 is($_,"GLOBAL VALUE","After the loop the implicit topic gets restored");
5a882b3c »
2008-07-29 [spectest] Unskip a test for Rakudo, and remove some tests for the no…
86 }
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
87
5a882b3c »
2008-07-29 [spectest] Unskip a test for Rakudo, and remove some tests for the no…
88 {
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
89 # as statement modifier
90 $_ = "GLOBAL VALUE";
91 is( .lc, "inner value", "Implicit default topic is seen by lc()" )
92 for "INNER VALUE";
93 is($_,"GLOBAL VALUE","After the loop the implicit topic gets restored");
94 }
95
96 ## and now for with 'topical' variables
97
98 # ... w/out parens
99
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
100 my $i = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
101 for 0 .. 5 -> $topic { $i = $i ~ $topic; };
102 is($i, '012345', 'for 0 .. 5 -> $topic {} works');
103
104 # ... with parens
105
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
106 my $j = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
107 for (0 .. 5) -> $topic { $j = $j ~ $topic; };
108 is($j, '012345', 'for () -> $topic {} works');
109
110
111 ## for with @array operator w/out parens
112
113 my @array_k = (0 .. 5);
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
114 my $k = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
115 for @array_k { $k = $k ~ $_; };
116 is($k, '012345', 'for @array {} works');
117
118 # ... with pointy blocks
119
120 my @array_l = (0 .. 5);
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
121 my $l = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
122 for @array_l -> $_ { $l = $l ~ $_; };
123 is($l, '012345', 'for @array -> {} works');
124
125 ## and now with parens around the @array
126
127 my @array_o = (0 .. 5);
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
128 my $o = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
129 for (@array_o) { $o = $o ~ $_; };
130 is($o, '012345', 'for (@array) {} works');
131
132 # ... with pointy blocks
133 {
134 my @array_p = (0 .. 5);
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
135 my $p = "";
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
136 for (@array_p) -> $_ { $p = $p ~ $_; };
137 is($p, '012345', 'for (@array) -> {} works');
138 }
139
140 my @elems = <a b c d e>;
141
142 {
143 my @a;
144 for (@elems) {
145 push @a, $_;
146 }
147 my @e = <a b c d e>;
148 is(@a, @e, 'for (@a) { ... $_ ... } iterates all elems');
149 }
150
151 {
152 my @a;
153 for (@elems) -> $_ { push @a, $_ };
154 my @e = @elems;
155 is(@a, @e, 'for (@a)->$_ { ... $_ ... } iterates all elems' );
156 }
157
158 {
159 my @a;
160 for (@elems) { push @a, $_, $_; }
161 my @e = <a a b b c c d d e e>;
162 is(@a, @e, 'for (@a) { ... $_ ... $_ ... } iterates all elems, not just odd');
163 }
164
912dda9d »
2008-07-17 [gsoc_spectest] added tests to for.t and fudged it for rakudo. (added…
165 # "for @a -> $var" is ro by default.
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
166 #?rakudo skip "<-> is confusing the parser, I think"
912dda9d »
2008-07-17 [gsoc_spectest] added tests to for.t and fudged it for rakudo. (added…
167 {
168 my @a = <1 2 3 4>;
169
170 eval_dies_ok('for @a -> $elem {$elem = 5}', '-> $var is ro by default');
171
172 for @a <-> $elem {$elem++;}
173 is(@a, <2 3 4 5>, '<-> $var is rw');
174
175 for @a <-> $first, $second {$first++; $second++}
176 is(@a, <3 4 5 6>, '<-> $var, $var2 works');
177 }
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
178
179 # for with "is rw"
180 {
181 my @array_s = (0..2);
182 my @s = (1..3);
183 for @array_s { $_++ };
184 is(@array_s, @s, 'for @array { $_++ }');
185 }
186
187 {
985603b3 »
2009-08-02 [t/spec] merge mis-placed mutating_listops.t into S04-statements/for.t
188 my @array = <a b c d>;
189 for @array { $_ ~= "c" }
190 is ~@array, "ac bc cc dc",
191 'mutating $_ in for works';
192 }
193
194 {
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
195 my @array_t = (0..2);
196 my @t = (1..3);
197 for @array_t -> $val is rw { $val++ };
198 is(@array_t, @t, 'for @array -> $val is rw { $val++ }');
199 }
200
201 #?pugs eval 'todo'
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
202 #?rakudo skip "is rw NYI"
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
203 {
204 my @array_v = (0..2);
205 my @v = (1..3);
206 for @array_v.values -> $val is rw { $val++ };
ea2ee24f »
2008-07-24 [STD] various bugs
207 is(@array_v, @v, 'for @array.values -> $val is rw { $val++ }');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
208 }
209
210 #?pugs eval 'todo'
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
211 #?rakudo skip "is rw NYI"
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
212 {
213 my @array_kv = (0..2);
214 my @kv = (1..3);
215 for @array_kv.kv -> $key, $val is rw { $val++ };
216 is(@array_kv, @kv, 'for @array.kv -> $key, $val is rw { $val++ }');
217 }
218
219 #?pugs eval 'todo'
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
220 #?rakudo skip "is rw NYI"
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
221 {
222 my %hash_v = ( a => 1, b => 2, c => 3 );
223 my %v = ( a => 2, b => 3, c => 4 );
224 for %hash_v.values -> $val is rw { $val++ };
225 is(%hash_v, %v, 'for %hash.values -> $val is rw { $val++ }');
226 }
227
228 #?pugs eval 'todo'
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
229 #?rakudo skip "is rw NYI"
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
230 {
231 my %hash_kv = ( a => 1, b => 2, c => 3 );
232 my %kv = ( a => 2, b => 3, c => 4 );
233 try { for %hash_kv.kv -> $key, $val is rw { $val++ }; };
83474c35 »
2008-12-12 [t/spec]: Clean up a few tests.
234 is( %hash_kv, %kv, 'for %hash.kv -> $key, $val is rw { $val++ }');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
235 }
236
237 # .key //= ++$i for @array1;
734bc95b »
2009-03-29 [t/spec]
238 class TestClass{ has $.key is rw };
239
b7e82501 »
2010-07-30 [t/spec] fixed unfudge mistake
240 #?rakudo skip '[+] NYI'
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
241 {
734bc95b »
2009-03-29 [t/spec]
242 my @array1 = (TestClass.new(:key<1>),TestClass.new());
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
243 my $i = 0;
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
244 for @array1 { .key //= ++$i }
734bc95b »
2009-03-29 [t/spec]
245 my $sum1 = [+] @array1.map: { $_.key };
ba8e84aa »
2009-06-19 [t/spec] Change more Pugs todo flags to fudge commands
246 #?pugs todo 'bug'
247 is( $sum1, 2, '.key //= ++$i for @array1;' );
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
248
249 }
250
251 # .key = 1 for @array1;
252 {
253 my @array1 = (TestClass.new(),TestClass.new(:key<2>));
254
734bc95b »
2009-03-29 [t/spec]
255 .key = 1 for @array1;
256 my $sum1 = [+] @array1.map: { $_.key };
257 is($sum1, 2, '.key = 1 for @array1;');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
258 }
259
260 # $_.key = 1 for @array1;
261 {
262 my @array1 = (TestClass.new(),TestClass.new(:key<2>));
263
4837029d »
2008-07-03 [spec] fudged for.t. Fails with 'Null PMC access in type()'
264 $_.key = 1 for @array1;
734bc95b »
2009-03-29 [t/spec]
265 my $sum1 = [+] @array1.map: { $_.key };
266 is( $sum1, 2, '$_.key = 1 for @array1;');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
267
268 }
269
270 # rw scalars
271 #L<S04/The C<for> statement/implicit parameter to block read/write "by default">
272 {
273 my ($a, $b, $c) = 0..2;
274 try { for ($a, $b, $c) { $_++ } };
275 is( [$a,$b,$c], [1,2,3], 'for ($a,$b,$c) { $_++ }');
276
277 ($a, $b, $c) = 0..2;
278 try { for ($a, $b, $c) -> $x is rw { $x++ } };
279 is( [$a,$b,$c], [1,2,3], 'for ($a,$b,$c) -> $x is rw { $x++ }');
280 }
281
282 # list context
283
284 {
4837029d »
2008-07-03 [spec] fudged for.t. Fails with 'Null PMC access in type()'
285 my $a = '';
da463c43 »
2008-07-24 [spec] S04-statements/for.t it's neither '=~' nor '~~', it's '~='
286 for 1..3, 4..6 { $a ~= $_.WHAT };
a524b513 »
2009-04-28 [t/spec]: protoobjects stringify to shortname plus parens (S12)
287 is($a, 'Int()Int()Int()Int()Int()Int()', 'List context');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
288
289 $a = '';
da463c43 »
2008-07-24 [spec] S04-statements/for.t it's neither '=~' nor '~~', it's '~='
290 for [1..3, 4..6] { $a ~= $_.WHAT };
a524b513 »
2009-04-28 [t/spec]: protoobjects stringify to shortname plus parens (S12)
291 is($a, 'Array()', 'List context');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
292
293 $a = '';
da463c43 »
2008-07-24 [spec] S04-statements/for.t it's neither '=~' nor '~~', it's '~='
294 for [1..3], [4..6] { $a ~= $_.WHAT };
a524b513 »
2009-04-28 [t/spec]: protoobjects stringify to shortname plus parens (S12)
295 is($a, 'Array()Array()', 'List context');
89aedbe2 »
2008-07-03 [spec] moved for.t to spec/, updated POD
296 }
033e98b2 »
2008-08-27 [t/spec] test for RT #58392, masak++
297
298 {
299 # this was a rakudo bug with mixed 'for' and recursion, which seems to
919fc4fa »
2008-11-25 [t/spec] unfudge passing rakudo test after lex branch merge (in for.t)
300 # confuse some lexical pads or the like, see RT #58392
033e98b2 »
2008-08-27 [t/spec] test for RT #58392, masak++
301 my $gather = '';
302 sub f($l) {
303 if $l <= 0 {
304 return $l;
305 }
306 $gather ~= $l;
307 for 1..3 {
308 f($l-1);
309 $gather ~= '.';
310 }
311 }
312 f(2);
313
314 is $gather, '21....1....1....', 'Can mix recursion and for';
315 }
316
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
317 # grep and sort in for - these were pugs bugs once, so let's
318 # keep them as regression tests
319
320 {
321 my @array = <1 2 3 4>;
322 my $output = '';
323
324 for (grep { 1 }, @array) -> $elem {
325 $output ~= "$elem,";
326 }
327
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
328 is $output, "1,2,3,4,", "grep works in for";
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
329 }
330
331 {
332 my @array = <1 2 3 4>;
333 my $output = '';
334
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
335 for @array.sort -> $elem {
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
336 $output ~= "$elem,";
337 }
338
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
339 is $output, "1,2,3,4,", "sort works in for";
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
340 }
341
342 {
343 my @array = <1 2 3 4>;
959cd56f »
2008-09-01 [t/spec] initialize a variable to make rakudo happy
344 my $output = '';
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
345
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
346 for (grep { 1 }, @array.sort) -> $elem {
764328fc »
2008-09-01 [t] merged statements/grepa-and-sort-in-for.t into spec/S04-statement…
347 $output ~= "$elem,";
348 }
349
350 is $output, "1,2,3,4,", "grep and sort work in for";
351 }
352
94226b45 »
2009-04-27 t/spec more smartlink fixes
353 # L<S04/Statement parsing/keywords require whitespace>
abbd86a4 »
2009-01-09 [t/spec] Added test for required whitespace after a built-in statemen…
354 eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
355
6e272576 »
2009-03-20 test for loop with two varibles
356 # looping with more than one loop variables
357 {
358 my @a = <1 2 3 4>;
359 my $str = '';
360 for @a -> $x, $y {
361 $str ~= $x+$y;
362 }
363 is $str, "37", "for loop with two variables";
364 }
365
e681f592 »
2009-03-20 for test
366 {
367 #my $str = '';
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
368 eval_dies_ok('for 1..5 -> $x, $y { $str ~= "$x$y" }', 'Should throw exception, no value for parameter $y');
e681f592 »
2009-03-20 for test
369 #is $str, "1234", "loop ran before throwing exception";
370 #diag ">$str<";
371 }
372
68b11e41 »
2009-07-29 [t/spec] label existing RT #63994 test
373 #?rakudo skip 'optional variable in for loop (RT #63994)'
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
374 #?niecza 2 skip 'NYI'
628aa1e3 »
2009-03-20 more for related test
375 {
376 my $str = '';
377 for 1..5 -> $x, $y? {
378 $str ~= " " ~ $x*$y;
379 }
380 is $str, " 2 12 0";
381 }
382
21ee0558 »
2009-03-20 test for loop with default value
383 {
384 my $str = '';
385 for 1..5 -> $x, $y = 7 {
386 $str ~= " " ~ $x*$y;
387 }
82c7ae07 »
2010-03-20 [t/spec] tests for :a[...] and :a{...} colonpair syntax
388 is $str, " 2 12 35", 'default values in for-loops';
21ee0558 »
2009-03-20 test for loop with default value
389 }
390
391
e681f592 »
2009-03-20 for test
392 {
393 my @a = <1 2 3>;
394 my @b = <4 5 6>;
395 my $res = '';
396 for @a Z @b -> $x, $y {
397 $res ~= " " ~ $x * $y;
398 }
399 is $res, " 4 10 18", "Z -ed for loop";
400 }
401
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
402 #?rakudo skip "Z only works with 2 arrays at the moment"
628aa1e3 »
2009-03-20 more for related test
403 {
404 my @a = <1 2 3>;
405 my $str = '';
406
407 for @a Z @a Z @a Z @a Z @a -> $q, $w, $e, $r, $t {
408 $str ~= " " ~ $q*$w*$e*$r*$t;
409 }
410 is $str, " 1 {2**5} {3**5}", "Z-ed for loop with 5 arrays";
411 }
e681f592 »
2009-03-20 for test
412
5faff5ea »
2009-03-20 testing infinite for loops
413 {
414 eval_dies_ok 'for 1.. { };', "Please use ..* for indefinite range";
415 eval_dies_ok 'for 1... { };', "1... does not exist";
416 }
417
418 {
419 my $c;
420 for 1..8 {
421 $c = $_;
422 last if $_ == 6;
423 }
424 is $c, 6, 'for loop ends in time using last';
425 }
426
427 {
428 my $c;
429 for 1..* {
430 $c = $_;
431 last if $_ == 6;
432 }
433 is $c, 6, 'infinte for loop ends in time using last';
434 }
435
436 {
437 my $c;
438 for 1..Inf {
439 $c = $_;
440 last if $_ == 6;
441 }
442 is $c, 6, 'infinte for loop ends in time using last';
443 }
444
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
445 # RT #62478
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
446 #?niecza skip 'different interpretation of eval'
f8f1bfdf »
2010-03-09 [t/spec] Massive refudge and tweaks to get for.t working in Rakudo, p…
447 {
448 eval('for (my $ii = 1; $ii <= 3; $ii++) { say $ii; }');
449 ok "$!" ~~ /C\-style/, 'mentions C-style';
450 ok "$!" ~~ /for/, 'mentions for';
451 ok "$!" ~~ /loop/, 'mentions loop';
452 }
453
4856f9e7 »
2009-08-16 [t/spec] Test for RT #65212
454 # RT #65212
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
455 #?niecza skip 'different eval'
4856f9e7 »
2009-08-16 [t/spec] Test for RT #65212
456 {
457 my $parsed = 0;
458 eval '$parsed = 1; for (1..3)->$n { last }';
459 ok ! $parsed, 'for (1..3)->$n fails to parse';
460 }
e681f592 »
2009-03-20 for test
461
1c97b6ef »
2009-12-28 [t/spec] Test for RT 71268: NPMCA from accessing result of "for ^1 {}"
462 # RT #71268
463 {
464 sub rt71268 { for ^1 {} }
465 lives_ok { ~(rt71268) }, 'can stringify "for ^1 {}" without death';
feebd088 »
2010-08-19 [t/spec]: Update some Nil-related tests for undefined Nil.
466 ok rt71268() ~~ (), 'result of "for ^1 {}" is ()';
1c97b6ef »
2009-12-28 [t/spec] Test for RT 71268: NPMCA from accessing result of "for ^1 {}"
467 }
468
6991d96e »
2010-03-23 RT62478 Unsupported use of C-style "for (;;)" loop
469 # RT 62478
470 {
29fe3613 »
2010-03-23 [t/spec] remove a say() that would confuse the TAP parser when the te…
471 eval_dies_ok 'for (my $i; $i <=3; $i++) { $i; }', 'Unsupported use of C-style "for (;;)" loop; in Perl 6 please use "loop (;;)"';
6991d96e »
2010-03-23 RT62478 Unsupported use of C-style "for (;;)" loop
472 }
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
473
474 #?niecza skip 'different eval semantics'
6991d96e »
2010-03-23 RT62478 Unsupported use of C-style "for (;;)" loop
475 {
4e5c79c7 »
2011-06-29 Fudge S04-statements/for.t for niecza
476 eval 'for (my $x; $x <=3; $x++) { $i; }'; diag($!);
477 ok $! ~~ / 'C-style' /, 'Sensible error message';
6991d96e »
2010-03-23 RT62478 Unsupported use of C-style "for (;;)" loop
478 }
1c97b6ef »
2009-12-28 [t/spec] Test for RT 71268: NPMCA from accessing result of "for ^1 {}"
479
c987a607 »
2010-07-30 [t/spec] tests for RT #64886 For (1..10000000000) bug
480 # RT #64886
481 {
482 my $a = 0;
483 for (1..10000000000) {
484 $a++;
485 last;
486 }
487 is $a, 1, 'for on Range with huge max value is lazy and enters block';
488 }
489
e76dd4c7 »
2010-12-31 s/done_testing/done/ as per recent S24 changes
490 done;
1c97b6ef »
2009-12-28 [t/spec] Test for RT 71268: NPMCA from accessing result of "for ^1 {}"
491
061d002f »
2008-12-14 [t/spec] various small improvements.
492 # vim: ft=perl6
Something went wrong with that request. Please try again.