Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (41 sloc) 0.838 kb
51a9ae3a »
2008-08-30 [spec] map-and-sort-in-for.t moved into 't/spec/S04-statements', and …
1 use v6;
2
3 use Test;
4
76ad216b »
2009-04-27 fix some more smartlinks
5 # L<S04/The C<for> statement>
6 # L<S32::Containers/List/=item map>
7 # L<S32::Containers/List/=item sort>
8
51a9ae3a »
2008-08-30 [spec] map-and-sort-in-for.t moved into 't/spec/S04-statements', and …
9 plan 4;
10
11 # works
12 {
13 my @array = <1 2 3 4>;
14 my $output='';
15
16 for (map { 1 }, @array) -> $elem {
17 $output ~= "$elem,";
18 }
19
20 is $output, "1,1,1,1,", "map works in for";
21 }
22
23 # works, too
24 {
25 my @array = <1 2 3 4>;
26 my $output='';
27
28 for sort @array -> $elem {
29 $output ~= "$elem,";
30 }
31
32 is $output, "1,2,3,4,", "sort works in for";
33 }
34
35 {
36 my @array = <1 2 3 4>;
37 my $output='';
38
39 for (map { 1 }, sort @array) -> $elem {
40 $output ~= "$elem,";
41 }
42
43 is $output, "1,1,1,1,", "map and sort work in for";
44 }
45
46 {
47 my @array = <1 2 3 4>;
48 my $output='';
49
50 for (map { $_ * 2 }, sort @array) -> $elem {
51 $output ~= "$elem,";
52 }
53
54 is $output, "2,4,6,8,", "map and sort work in for";
55 }
7f29bc53 »
2009-08-08 [t/spec] Add vim: lines everywhere.
56
57 # vim: ft=perl6
Something went wrong with that request. Please try again.