Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 333 lines (289 sloc) 12.901 kb
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
1 use v6;
2 use Test;
e122112 [t/spec] fix reduce-metaop.t, moritz--
moritz authored
3
5b5d98a @moritz [reduce.t] tests for RT #76110
moritz authored
4 plan 356;
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
5
6 =begin pod
7
8 =head1 DESCRIPTION
9
10 This test tests the C<[...]> reduce metaoperator.
11
12 Reference:
13 L<"http://groups.google.de/group/perl.perl6.language/msg/bd9eb275d5da2eda">
14
15 =end pod
16
17 # L<S03/"Reduction operators">
18
19 # [...] reduce metaoperator
20 {
21 my @array = <5 -3 7 0 1 -9>;
22 my $sum = 5 + -3 + 7 + 0 + 1 + -9; # laziness :)
23
24 is(([+] @array), $sum, "[+] works");
25 is(([*] 1,2,3), (1*2*3), "[*] works");
26 is(([-] 1,2,3), (1-2-3), "[-] works");
27 is(([/] 12,4,3), (12/4/3), "[/] works");
9b6c25a [t/spec] Add simple tests for [div] and [mod].
colomon authored
28 is(([div] 12,4,3), (12 div 4 div 3), "[div] works");
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
29 is(([**] 2,2,3), (2**2**3), "[**] works");
5d1999e [t/spec] a test for [%] (meta reduce modulo)
moritz authored
30 is(([%] 13,7,4), (13%7%4), "[%] works");
9b6c25a [t/spec] Add simple tests for [div] and [mod].
colomon authored
31 is(([mod] 13,7,4), (13 mod 7 mod 4), "[mod] works");
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
32
33 is((~ [\+] @array), "5 2 9 9 10 1", "[\\+] works");
34 is((~ [\-] 1, 2, 3), "1 -1 -4", "[\\-] works");
35 }
36
37 {
38 is ([~] <a b c d>), "abcd", "[~] works";
39 is (~ [\~] <a b c d>), "a ab abc abcd", "[\\~] works";
40 }
41
42 {
ea847c7 @moritz remove more wrong uses of True and False as 0 and 1 (still more left); m...
moritz authored
43 ok ([<] 1, 2, 3, 4), "[<] works (1)";
44 nok ([<] 1, 3, 2, 4), "[<] works (2)";
45 ok ([>] 4, 3, 2, 1), "[>] works (1)";
46 nok ([>] 4, 2, 3, 1), "[>] works (2)";
47 ok ([==] 4, 4, 4), "[==] works (1)";
48 nok ([==] 4, 5, 4), "[==] works (2)";
49 ok ([!=] 4, 5, 6), "[!=] works (1)";
50 nok ([!=] 4, 4, 4), "[!=] works (2)";
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
51 }
d1ccd8b [t/spec] tests for === and =:= and their negated forms inside meta ops
moritz authored
52
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
53 {
e75736f [t/spec] tests for [eq], [ne]
moritz authored
54 ok (! [eq] <a a b a>), '[eq] basic sanity (positive)';
55 ok ( [eq] <a a a a>), '[eq] basic sanity (negative)';
56 ok ( [ne] <a b c a>), '[ne] basic sanity (positive)';
57 ok (! [ne] <a a b c>), '[ne] basic sanity (negative)';
58 ok ( [lt] <a b c e>), '[lt] basic sanity (positive)';
59 ok (! [lt] <a a c e>), '[lt] basic sanity (negative)';
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
60 }
e75736f [t/spec] tests for [eq], [ne]
moritz authored
61
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
62 #?rakudo skip "=:= NYI"
63 {
d1ccd8b [t/spec] tests for === and =:= and their negated forms inside meta ops
moritz authored
64 my ($x, $y);
65 ok ( [=:=] $x, $x, $x), '[=:=] basic sanity 1';
66 ok (not [=:=] $x, $y, $x), '[=:=] basic sanity 2';
67 ok ( [!=:=] $x, $y, $x), '[!=:=] basic sanity (positive)';
68 ok (not [!=:=] $y, $y, $x), '[!=:=] basic sanity (negative)';
69 $y := $x;
70 ok ( [=:=] $y, $x, $y), '[=:=] after binding';
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
71 }
d1ccd8b [t/spec] tests for === and =:= and their negated forms inside meta ops
moritz authored
72
e7dbb23 [t/spec] Refudge S03-metaops/reduce.t a bit so that it works again.
colomon authored
73 {
d1ccd8b [t/spec] tests for === and =:= and their negated forms inside meta ops
moritz authored
74 my $a = [1, 2];
75 my $b = [1, 2];
76
ea847c7 @moritz remove more wrong uses of True and False as 0 and 1 (still more left); m...
moritz authored
77 ok ([===] 1, 1, 1, 1), '[===] with literals';
78 ok ([===] $a, $a, $a), '[===] with vars (positive)';
79 nok ([===] $a, $a, [1, 2]), '[===] with vars (negative)';
80 ok ([!===] $a, $b, $a), '[!===] basic sanity (positive)';
81 nok ([!===] $a, $b, $b), '[!===] basic sanity (negative)';
434eb4e [t/spec] Unfudge tests for reduction meta-operator with chaining comparr...
jnthn authored
82 }
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
83
434eb4e [t/spec] Unfudge tests for reduction meta-operator with chaining comparr...
jnthn authored
84 {
29b04a9 @moritz fix tests for Bool stringification
moritz authored
85 is ~ ([\<] 1, 2, 3, 4).map({+$_}), "1 1 1 1", "[\\<] works (1)";
86 is ~ ([\<] 1, 3, 2, 4).map({+$_}), "1 1 0 0", "[\\<] works (2)";
87 is ~ ([\>] 4, 3, 2, 1).map({+$_}), "1 1 1 1", "[\\>] works (1)";
88 is ~ ([\>] 4, 2, 3, 1).map({+$_}), "1 1 0 0", "[\\>] works (2)";
89 is ~ ([\==] 4, 4, 4).map({+$_}), "1 1 1", "[\\==] works (1)";
90 is ~ ([\==] 4, 5, 4).map({+$_}), "1 0 0", "[\\==] works (2)";
91 is ~ ([\!=] 4, 5, 6).map({+$_}), "1 1 1", "[\\!=] works (1)";
92 is ~ ([\!=] 4, 5, 5).map({+$_}), "1 1 0", "[\\!=] works (2)";
5cb1e9f [t/spec] Fix triangle form of reduce metaop tests.
bacek authored
93 is (~ [\**] 1, 2, 3), "3 8 1", "[\\**] (right assoc) works (1)";
94 is (~ [\**] 3, 2, 0), "0 1 3", "[\\**] (right assoc) works (2)";
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
95 }
96
5b5d98a @moritz [reduce.t] tests for RT #76110
moritz authored
97 # RT #76110
98 {
99 is ~([\+] [\+] 1 xx 5), '1 3 6 10 15', 'two nested [\+]';
100 is ([+] [1, 2, 3, 4]), 4, '[+] does not flatten []-arrays';
101 }
102
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
103 {
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
104 my @array = (Mu, Mu, 3, Mu, 5);
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
105 is ([//] @array), 3, "[//] works";
4acefb9 [t/spec] unfudge [//] and [||] tests for rakudo
moritz authored
106 #?rakudo skip '[orelse]'
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
107 is ([orelse] @array), 3, "[orelse] works";
108 }
109
110 {
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
111 my @array = (Mu, Mu, 0, 3, Mu, 5);
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
112 is ([||] @array), 3, "[||] works";
113 is ([or] @array), 3, "[or] works";
114
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
115 # Mu as well as [//] should work too, but testing it like
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
116 # this would presumably emit warnings when we have them.
117 is (~ [\||] 0, 0, 3, 4, 5), "0 0 3 3 3", "[\\||] works";
118 }
119
fc7413f [t/spec] Tests for [&&] and [and]. Patch courtesy of (Alex Kapranoff)++.
jnthn authored
120 {
121 my @array = (Mu, Mu, 0, 3, Mu, 5);
122 my @array1 = (2, 3, 4);
123 nok ([&&] @array), "[&&] works with 1 false";
124 is ([&&] @array1), 4, "[&&] works";
125 nok ([and] @array), "[and] works with 1 false";
126 is ([and] @array1), 4, "[and] works";
127 }
128
bc058f2 [STD] improve parsing of reduceops
lwall authored
129 # not currently legal without an infix subscript operator
130 # {
131 # my $hash = {a => {b => {c => {d => 42, e => 23}}}};
132 # is try { [.{}] $hash, <a b c d> }, 42, '[.{}] works';
133 # }
134 #
135 # {
136 # my $hash = {a => {b => 42}};
137 # is ([.{}] $hash, <a b>), 42, '[.{}] works two levels deep';
138 # }
139 #
140 # {
141 # my $arr = [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]];
142 # is ([.[]] $arr, 1, 0, 2), 9, '[.[]] works';
143 # }
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
144
145 {
146 # 18:45 < autrijus> hm, I found a way to easily do linked list consing in Perl6
147 # 18:45 < autrijus> [=>] 1..10;
148 my $list = [=>] 1,2,3;
ed68273 [t/spec] remove usage of try as a function
moritz authored
149 is $list.key, 1, "[=>] works (1)";
150 is (try {$list.value.key}), 2, "[=>] works (2)";
151 is (try {$list.value.value}), 3, "[=>] works (3)";
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
152 }
153
154 {
21768a7 [t/spec] clean up and fudge reduce-metaop.t for rakudo.
moritz authored
155 my @array = <5 -3 7 0 1 -9>;
156 # according to http://irclog.perlgeek.de/perl6/2008-09-10#i_560910
157 # [,] returns a scalar (holding an Array)
158 my $count = 0;
159 $count++ for [,] @array;
160 is $count, 1, '[,] returns a single Array';
a246cb9 [t/spec] correct a test for [,], and unfudge a few for rakudo
moritz authored
161 ok ([,] @array) ~~ Positional, '[,] returns something Positional';
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
162 }
163
164 # Following two tests taken verbatim from former t/operators/reduce.t
165 lives_ok({my @foo = [1..3] >>+<< [1..3] >>+<< [1..3]},'Sanity Check');
166 lives_ok({my @foo = [>>+<<] ([1..3],[1..3],[1..3])},'Parse [>>+<<]');
167
168 # Check that user defined infix ops work with [...], too.
21768a7 [t/spec] clean up and fudge reduce-metaop.t for rakudo.
moritz authored
169 #?pugs todo 'bug'
8de8af6 [t/spec] partially fudge reduce.t for rakudo
moritz authored
170 #?rakudo skip 'reduce of user defined op'
21768a7 [t/spec] clean up and fudge reduce-metaop.t for rakudo.
moritz authored
171 {
172 sub infix:<more_than_plus>(Int $a, Int $b) { $a + $b + 1 }
d1ccd8b [t/spec] tests for === and =:= and their negated forms inside meta ops
moritz authored
173 is (try { [more_than_plus] 1, 2, 3 }), 8, "[...] reduce metaop works on user defined ops";
21768a7 [t/spec] clean up and fudge reduce-metaop.t for rakudo.
moritz authored
174 }
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
175
f148336 [STD vs t] user-defined prefix, infix, and postfix ops now derive new la...
lwall authored
176 # {
177 # my $arr = [ 42, [ 23 ] ];
178 # $arr[1][1] = $arr;
179 #
180 # is try { [.[]] $arr, 1, 1, 1, 1, 1, 0 }, 23, '[.[]] works with infinite data structures';
181 # }
182 #
183 # {
184 # my $hash = {a => {b => 42}};
185 # $hash<a><c> = $hash;
186 #
187 # is try { [.{}] $hash, <a c a c a b> }, 42, '[.{}] works with infinite data structures';
188 # }
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
189
190 # L<S03/"Reduction operators"/"Among the builtin operators, [+]() returns 0 and [*]() returns 1">
191
21768a7 [t/spec] clean up and fudge reduce-metaop.t for rakudo.
moritz authored
192 is( ([*]()), 1, "[*]() returns 1");
193 is( ([+]()), 0, "[+]() returns 0");
932a1bc [gsoc_spectest] reorganization of reduce tests
Auzon authored
194
2d7d862 [t/spec] Add a few tests for the one-argument case.
colomon authored
195 is( ([*] 41), 41, "[*] 41 returns 41");
196 is( ([*] 42), 42, "[*] 42 returns 42");
0e61dff [t/spec] Add a few more tests for the one-argument case.
colomon authored
197 is( ~([\*] 42), "42", "[\*] 42 returns (42)");
2d7d862 [t/spec] Add a few tests for the one-argument case.
colomon authored
198 is( ([~] 'towel'), 'towel', "[~] 'towel' returns 'towel'");
199 is( ([~] 'washcloth'), 'washcloth', "[~] 'washcloth' returns 'washcloth'");
0e61dff [t/spec] Add a few more tests for the one-argument case.
colomon authored
200 is( ([\~] 'towel'), 'towel', "[\~] 'towel' returns 'towel'");
f9ed5f4 [reduce.t] fix parsefail
lwall authored
201 ok( ([\~] 'towel') ~~ Iterable, "[\~] 'towel' returns something Iterable");
2d7d862 [t/spec] Add a few tests for the one-argument case.
colomon authored
202 is( ([<] 42), Bool::True, "[<] 42 returns true");
ea847c7 @moritz remove more wrong uses of True and False as 0 and 1 (still more left); m...
moritz authored
203 is( ~([\<] 42), ~True, "[\<] 42 returns '1'");
0e61dff [t/spec] Add a few more tests for the one-argument case.
colomon authored
204 ok( ([\<] 42) ~~ Iterable, "[\<] 42 returns something Iterable");
2d7d862 [t/spec] Add a few tests for the one-argument case.
colomon authored
205
9e9686f [t/spec] replace .batch($x) with .[^$x]
moritz authored
206 is( ([\*] 1..*).[^10].join(', '), '1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800',
09a80e6 [t/spec] Add two tests for lazy triangle reduce.
colomon authored
207 'triangle reduce is lazy');
9e9686f [t/spec] replace .batch($x) with .[^$x]
moritz authored
208 is( ([\R~] 'a'..*).[^8].join(', '), 'a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba',
09a80e6 [t/spec] Add two tests for lazy triangle reduce.
colomon authored
209 'triangle reduce is lazy');
210
748c769 Additions and unfudging for &infix:<^^> and &infix:<xor>.
Kodi Arfer authored
211 # RT #65164 implement [^^]
f80ef63 [t/spec] Tests for RT #65164
kyle authored
212 {
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
213 is ([^^] 0, 42), 42, '[^^] works (one of two true)';
214 is ([^^] 42, 0), 42, '[^^] works (one of two true)';
215 ok ! ([^^] 1, 42), '[^^] works (two true)';
216 ok ! ([^^] 0, 0), '[^^] works (two false)';
f80ef63 [t/spec] Tests for RT #65164
kyle authored
217
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
218 ok ! ([^^] 0, 0, 0), '[^^] works (three false)';
219 ok ! ([^^] 5, 9, 17), '[^^] works (three true)';
f80ef63 [t/spec] Tests for RT #65164
kyle authored
220
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
221 is ([^^] 5, 9, 0), (5 ^^ 9 ^^ 0), '[^^] mix 1';
222 is ([^^] 5, 0, 17), (5 ^^ 0 ^^ 17), '[^^] mix 2';
223 is ([^^] 0, 9, 17), (0 ^^ 9 ^^ 17), '[^^] mix 3';
224 is ([^^] 5, 0, 0), (5 ^^ 0 ^^ 0), '[^^] mix 4';
225 is ([^^] 0, 9, 0), (0 ^^ 9 ^^ 0), '[^^] mix 5';
226 is ([^^] 0, 0, 17), (0 ^^ 0 ^^ 17), '[^^] mix 6';
e9cdf15 @felliott add tests for RT #65164 (chained-xor reduce: [^^])
felliott authored
227
689122d [reduce.t] Added test for [^^] on an empty list (thundergnat++).
Kodi Arfer authored
228 nok ([^^] ()), 'reduce empty list ok';
229
e9cdf15 @felliott add tests for RT #65164 (chained-xor reduce: [^^])
felliott authored
230 # test False / undefined things
231 my $msg1 = 'reduce [^^] false variable test';
232 my $msg2 = 'infix ^^ false variable test';
233 for (0, '0', '', Bool::False, Any, Mu, Nil) -> $undef {
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
234 ok ( [^^] $undef, $undef, $undef, 5 ), "|{$undef.perl}| $msg1 \#1";
235 nok ( [^^] 1, 2, $undef, 3, $undef ), "|{$undef.perl}| $msg1 \#2";
236 nok ( [^^] $undef, $undef, 1, 5 ), "|{$undef.perl}| $msg1 \#3";
237 nok ( [^^] 1, $undef, $undef, 5 ), "|{$undef.perl}| $msg1 \#4";
238 ok ( [^^] $undef, $undef, 2, $undef ), "|{$undef.perl}| $msg1 \#5";
239 nok ( [^^] $undef, $undef, $undef ), "|{$undef.perl}| $msg1 \#6";
240 nok ( [^^] $undef, $undef ), "|{$undef.perl}| $msg1 \#7";
241 ok ( [^^] $undef, 1 ), "|{$undef.perl}| $msg1 \#8";
242 ok ( [^^] 1, $undef ), "|{$undef.perl}| $msg1 \#9";
243 nok ( [^^] $undef ), "|{$undef.perl}| $msg1 \#10";
e9cdf15 @felliott add tests for RT #65164 (chained-xor reduce: [^^])
felliott authored
244 ok ( $undef ^^ $undef ^^ $undef ^^ 5 ), "|{$undef.perl}| $msg2 \#1";
245 nok ( 1 ^^ 2 ^^ $undef ^^ 3 ^^ $undef ), "|{$undef.perl}| $msg2 \#2";
246 nok ( $undef ^^ $undef ^^ 1 ^^ 5 ), "|{$undef.perl}| $msg2 \#3";
247 nok ( 1 ^^ $undef ^^ $undef ^^ 5 ), "|{$undef.perl}| $msg2 \#4";
248 ok ( $undef ^^ $undef ^^ 2 ^^ $undef ), "|{$undef.perl}| $msg2 \#5";
249 nok ( $undef ^^ $undef ^^ $undef ), "|{$undef.perl}| $msg2 \#6";
250 nok ( $undef ^^ $undef ), "|{$undef.perl}| $msg2 \#7";
251 ok ( $undef ^^ 1 ), "|{$undef.perl}| $msg2 \#8";
252 ok ( 1 ^^ $undef ), "|{$undef.perl}| $msg2 \#9";
253 }
254
255 # test numericy true things
256 $msg1 = 'reduce [^^] true numbery variable test';
257 $msg2 = 'infix ^^ true numbery variable test';
258 for (1, -147, pi, Bool::True) -> $def {
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
259 nok ( [^^] 0, 0, $def, 3, $def ), "|{$def.perl}| $msg1 \#1";
260 nok ( [^^] $def, $def, 0 ), "|{$def.perl}| $msg1 \#2";
261 nok ( [^^] 1, $def, Any, 5 ), "|{$def.perl}| $msg1 \#3";
262 ok ( [^^] $def, 0, 0, 0 ) == $def, "|{$def.perl}| $msg1 \#4";
263 ok ( [^^] Any, Any, Any, $def ) == $def, "|{$def.perl}| $msg1 \#5";
264 nok ( [^^] $def, $def ), "|{$def.perl}| $msg1 \#6";
265 ok ( [^^] $def, 0 ) == $def, "|{$def.perl}| $msg1 \#7";
266 ok ( [^^] 0, $def ) == $def, "|{$def.perl}| $msg1 \#8";
267 ok ( [^^] $def ), "|{$def.perl}| $msg1 \#9";
e9cdf15 @felliott add tests for RT #65164 (chained-xor reduce: [^^])
felliott authored
268 nok ( 0 ^^ 0 ^^ $def ^^ 3 ^^ $def ), "|{$def.perl}| $msg2 \#1";
269 nok ( $def ^^ $def ^^ 0 ), "|{$def.perl}| $msg2 \#2";
270 nok ( 1 ^^ $def ^^ Any ^^ 5 ), "|{$def.perl}| $msg2 \#3";
271 ok ( $def ^^ 0 ^^ 0 ^^ 0 ) == $def, "|{$def.perl}| $msg2 \#4";
272 ok ( Any ^^ Any ^^ Any ^^ $def ) == $def,"|{$def.perl}| $msg2 \#5";
273 nok ( $def ^^ $def ), "|{$def.perl}| $msg2 \#6";
274 ok ( $def ^^ 0 ) == $def, "|{$def.perl}| $msg2 \#7";
275 ok ( 0 ^^ $def ) == $def, "|{$def.perl}| $msg2 \#8";
276 }
277
278 # test stringy true things
279 $msg1 = 'reduce [^^] true string variable test';
280 $msg2 = 'infix ^^ true string variable test';
281 for ('no', 'Bob', '10', 'False') -> $def {
de5c0ff [reduce.t] Edited [^^] tests so RT #77442 isn't a prerequisite.
Kodi Arfer authored
282 nok ( [^^] $def, $def, $def, 'string' ), "|{$def.perl}| $msg1 \#1";
283 nok ( [^^] '', '', $def, 'str', $def ), "|{$def.perl}| $msg1 \#2";
284 nok ( [^^] $def, $def,'' ), "|{$def.perl}| $msg1 \#3";
285 nok ( [^^] 1, $def, Any, 5 ), "|{$def.perl}| $msg1 \#4";
286 ok ( [^^] $def, '', '', '' ) eq $def, "|{$def.perl}| $msg1 \#5";
287 ok ( [^^] Any, Any, Any, $def ) eq $def, "|{$def.perl}| $msg1 \#6";
288 nok ( [^^] $def, $def ), "|{$def.perl}| $msg1 \#7";
289 ok ( [^^] $def, '' ) eq $def, "|{$def.perl}| $msg1 \#8";
290 ok ( [^^] '', $def ) eq $def, "|{$def.perl}| $msg1 \#9";
291 ok ( [^^] $def ) eq $def, "|{$def.perl}| $msg1 \#10";
e9cdf15 @felliott add tests for RT #65164 (chained-xor reduce: [^^])
felliott authored
292 nok ( $def ^^ $def ^^ $def ^^ 'string' ), "|{$def.perl}| $msg2 \#1";
293 nok ( '' ^^ '' ^^ $def ^^ 'str' ^^ $def ),"|{$def.perl}| $msg2 \#2";
294 nok ( $def ^^ $def ^^'' ), "|{$def.perl}| $msg2 \#3";
295 nok ( 1 ^^ $def ^^ Any ^^ 5 ), "|{$def.perl}| $msg2 \#4";
296 ok ( $def ^^ '' ^^ '' ^^ '' ) eq $def, "|{$def.perl}| $msg2 \#5";
297 ok ( Any ^^ Any ^^ Any ^^ $def ) eq $def,"|{$def.perl}| $msg2 \#6";
298 nok ( $def ^^ $def ), "|{$def.perl}| $msg2 \#7";
299 ok ( $def ^^ '' ) eq $def, "|{$def.perl}| $msg2 \#8";
300 ok ( '' ^^ $def ) eq $def, "|{$def.perl}| $msg2 \#9";
301 }
302
748c769 Additions and unfudging for &infix:<^^> and &infix:<xor>.
Kodi Arfer authored
303 is (join ', ', [\^^] False, 0, 5, '', False, 16, 0, Any, "hello", False),
304 (join ', ', False, 0, 5, 5, 5, False, False, False, False, False),
305 '[\^^]';
306 is (join ', ', [\xor] 'xyzzy', Int, 0.0, '', False, 'plugh', 4, 2, 'xyzzy'),
307 (join ', ', 'xyzzy', 'xyzzy', 'xyzzy', 'xyzzy', 'xyzzy', False, False, False, False),
308 '[\xor]';
f80ef63 [t/spec] Tests for RT #65164
kyle authored
309 }
310
65d1a8d [t/spec] tests for RT #75234, using a metaop in one class hides it from ...
moritz authored
311 # RT #75234
312 # rakudo had a problem where once-used meta operators weren't installed
313 # in a sufficiently global location, so using a meta operator in class once
314 # makes it unusable further on
315 {
316 class A {
317 method m { return [~] gather for ^3 {take 'a'} }
318 }
319 class B {
320 method n { return [~] gather for ^4 {take 'b'}}
321 }
322 is A.new.m, 'aaa', '[~] works in first class';
323 is B.new.n, 'bbbb', '[~] works in second class';
324 is ([~] 1, 2, 5), '125', '[~] works outside class';
325 }
326
c5240b2 @kyleha [reduce] Test for RT 82210: Misparse of metaop with immediate ()
kyleha authored
327 #?rakudo todo 'RT 82210'
328 ok [+](1..10) + 0 == ([+] 1..10) + 0,
329 'a listop with immediate () is a function call (RT 82210)';
330
e76dd4c @moritz s/done_testing/done/ as per recent S24 changes
moritz authored
331 done;
4acefb9 [t/spec] unfudge [//] and [||] tests for rakudo
moritz authored
332 # vim: ft=perl6
Something went wrong with that request. Please try again.