Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 107 lines (85 sloc) 2.49 kb
d198f6b [t/spec] s/use v6-alpha;/use v6;/
moritz authored
1 use v6;
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
2 use Test;
3
ccace72 [t/spec] fix smartlinks in S32-list
moritz authored
4 # L<S32::Containers/List/"=item reverse">
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
5
c5fa27b @moritz [S32] remove more tests for now-gone calling-positionals-by-named tests
moritz authored
6 plan 21;
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
7
8
9
8313f3f [t/spec] Converted pod markers to pod6
cosimo authored
10 =begin pod
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
11
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
12 Tests for "reverse", which always reverse lists now. See flip()
13 in S32-str for the string reversal
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
14
8313f3f [t/spec] Converted pod markers to pod6
cosimo authored
15 =end pod
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
16
17
18 my @a = reverse(1, 2, 3, 4);
19 my @e = (4, 3, 2, 1);
20
21 is(@a, @e, "list was reversed");
c10e241 [t/spec] Change "list reverse" to just "reverse". Not sure what the lis...
colomon authored
22
b53777a [gsoc_spectest] fudged reverse.t for Rakudo
Auzon authored
23 {
24 my $a = reverse("foo");
13ef69c [t/spec] string reversal is now spelled flip()
moritz authored
25 is($a, "foo", "string was not reversed; that's what flip() is for");
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
26
c10e241 [t/spec] Change "list reverse" to just "reverse". Not sure what the lis...
colomon authored
27 @a = reverse "foo", "bar";
b53777a [gsoc_spectest] fudged reverse.t for Rakudo
Auzon authored
28 is(+@a, 2, 'the reversed list has two elements');
29 is(@a[0], "bar", 'the list was reversed properly');
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
30
b53777a [gsoc_spectest] fudged reverse.t for Rakudo
Auzon authored
31 is(@a[1], "foo", 'the list was reversed properly');
32 }
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
33
6026160 [reverse.t] there is no want function anymore
lwall authored
34 # #?rakudo skip 'want()'
35 # {
36 # my @cxt_log;
37 #
38 # class Foo {
39 # my @.n;
40 # method foo () {
41 # push @cxt_log, want();
42 # (1, 2, 3)
43 # }
44 # method bar () {
45 # push @cxt_log, want();
46 # return @!n = do {
47 # push @cxt_log, want();
48 # reverse self.foo;
49 # }
50 # }
51 # }
52 #
53 # my @n = do {
54 # push @cxt_log, want();
55 # Foo.new.bar;
56 # };
57 #
58 # is(~@cxt_log, ~("List (Any)" xx 4), "contexts were passed correctly around masak's bug");
59 # is(+@n, 3, "list context reverse in masak's bug");
60 # is(~@n, "3 2 1", "elements seem reversed");
61 # }
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
62
223d9a7 [t] added named arg tests for reverse
frew authored
63 {
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
64 my @a = "foo";
65 my @b = @a.reverse;
ecf161e @colomon Fudge for niecza.
colomon authored
66 #?niecza skip "Iterable NYI"
1de05be [t/spec] Change the type we desire to get back from "reverse" to Iterabl...
colomon authored
67 isa_ok(@b, Iterable);
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
68 my $b = @a.reverse;
ecf161e @colomon Fudge for niecza.
colomon authored
69 #?niecza skip "Iterable NYI"
1de05be [t/spec] Change the type we desire to get back from "reverse" to Iterabl...
colomon authored
70 isa_ok($b, Iterable);
223d9a7 [t] added named arg tests for reverse
frew authored
71 is(@b[0], "foo", 'our list is reversed properly');
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
72 is($b, "foo", 'in scalar context it is still a list');
73 is(@a[0], "foo", "original array left untouched");
74 @a .= reverse;
75 is(@a[0], "foo", 'in place reversal works');
76 }
77
78 {
79 my @a = ("foo", "bar");
80 my @b = @a.reverse;
ecf161e @colomon Fudge for niecza.
colomon authored
81 #?niecza skip "Iterable NYI"
1de05be [t/spec] Change the type we desire to get back from "reverse" to Iterabl...
colomon authored
82 isa_ok(@b, Iterable);
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
83 my $b = @a.reverse;
ecf161e @colomon Fudge for niecza.
colomon authored
84 #?niecza skip "Iterable NYI"
1de05be [t/spec] Change the type we desire to get back from "reverse" to Iterabl...
colomon authored
85 isa_ok($b, Iterable);
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
86 is(@b[0], "bar", 'our array is reversed');
87 is(@b[1], "foo", 'our array is reversed');
223d9a7 [t] added named arg tests for reverse
frew authored
88
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
89 is($b, "bar foo", 'in scalar context it is still a list');
223d9a7 [t] added named arg tests for reverse
frew authored
90
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
91 is(@a[0], "foo", "original array left untouched");
92 is(@a[1], "bar", "original array left untouched");
223d9a7 [t] added named arg tests for reverse
frew authored
93
4d29ac3 Converted some *.t scripts to unix format (?)
cosimo authored
94 @a .= reverse;
95 is(@a[0], "bar", 'in place reversal works');
96 is(@a[1], "foo", 'in place reversal works');
97 }
98
280ebde @moritz test for RT #77914, .reverse shoudl flatten parcels
moritz authored
99 # RT #77914
25668e6 @coke Prefer RT #XXXXXX
coke authored
100 #?rakudo todo "RT #77914"
ecf161e @colomon Fudge for niecza.
colomon authored
101 #?niecza skip 'Unable to resolve method reverse in class Parcel'
280ebde @moritz test for RT #77914, .reverse shoudl flatten parcels
moritz authored
102 {
103 is (<a b>, <c d>).reverse.join, 'dcba', '.reverse flattens parcels';
104 }
105
04648dc [t/spec] move Hash.reverse tests in separate file, and bring them up-to-...
moritz authored
106 # vim: ft=perl6
Something went wrong with that request. Please try again.