Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 425 lines (326 sloc) 12.759 kb
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
1 use v6;
2
3 use Test;
4
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
5 plan 102;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
6
7 =begin pod
8
9 Misc. Junction tests
10
11 =end pod
12
fc2707f (un)fudge tests
kboga authored
13 # RT #64184
14 {
15 isa_ok any(6,7), Junction;
16 is any(6,7).WHAT.gist, Junction.gist, 'junction.WHAT works';
17 }
3f05e7f [t/spec] identifying a junction causes Null PMC
kyle authored
18
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
19 # avoid auto-threading on ok()
0836cea @coke nom fudging
coke authored
20 #?DOES 1
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
21 sub jok(Mu $condition, $msg?) { ok ?($condition), $msg };
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
22
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
23 # L<S03/Junctive operators>
24 # L<S09/Junctions>
25 {
26
13cc9c4 [t/spec] 71 typos in 32 files.
Util authored
27 # initialize them all to empty strings
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
28 my $a = '';
29 my $b = '';
30 my $c = '';
31
32 # make sure they all match to an empty string
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
33 jok('' eq ($a & $b & $c), 'junction of ($a & $b & $c) matches an empty string');
34 jok('' eq all($a, $b, $c), 'junction of all($a, $b, $c) matches an empty string');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
35
36 # give $a a value
37 $a = 'a';
38
39 # make sure that at least one of them matches 'a'
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
40 jok('a' eq ($b | $c | $a), 'junction of ($b | $c | $a) matches at least one "a"');
41 jok('a' eq any($b, $c, $a), 'junction of any($b, $c, $a) matches at least one "a"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
42
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
43 jok('' eq ($b | $c | $a), 'junction of ($b | $c | $a) matches at least one empty string');
44 jok('' eq any($b, $c, $a), 'junction of any($b, $c, $a) matches at least one empty string');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
45
46 # make sure that ~only~ one of them matches 'a'
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
47 jok('a' eq ($b ^ $c ^ $a), 'junction of ($b ^ $c ^ $a) matches at ~only~ one "a"');
48 jok('a' eq one($b, $c, $a), 'junction of one($b, $c, $a) matches at ~only~ one "a"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
49
50 # give $b a value
51 $b = 'a';
52
53 # now this will fail
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
54 jok('a' ne ($b ^ $c ^ $a), 'junction of ($b ^ $c ^ $a) matches at more than one "a"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
55
56 # change $b and give $c a value
57 $b = 'b';
58 $c = 'c';
59
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
60 jok('a' eq ($b ^ $c ^ $a), 'junction of ($b ^ $c ^ $a) matches at ~only~ one "a"');
61 jok('b' eq ($a ^ $b ^ $c), 'junction of ($a ^ $b ^ $c) matches at ~only~ one "b"');
62 jok('c' eq ($c ^ $a ^ $b), 'junction of ($c ^ $a ^ $b) matches at ~only~ one "c"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
63
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
64 jok('a' eq ($b | $c | $a), 'junction of ($b | $c | $a) matches at least one "a"');
65 jok('b' eq ($a | $b | $c), 'junction of ($a | $b | $c) matches at least one "b"');
66 jok('c' eq ($c | $a | $b), 'junction of ($c | $a | $b) matches at least one "c"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
67
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
68 #?niecza 3 skip '==='
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
69 ok(not(('a' eq ($b | $c | $a)) === Bool::False), 'junctional comparison doesn not mistakenly return both true and false');
70 ok(not(('b' eq ($a | $b | $c)) === Bool::False), 'junctional comparison doesn not mistakenly return both true and false');
71 ok(not(('c' eq ($c | $a | $b)) === Bool::False), 'junctional comparison doesn not mistakenly return both true and false');
72
73 # test junction to junction
0836cea @coke nom fudging
coke authored
74 #?rakudo skip 'nom regression'
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
75 jok(('a' | 'b' | 'c') eq ($a & $b & $c), 'junction ("a" | "b" | "c") matches junction ($a & $b & $c)');
76 jok(('a' & 'b' & 'c') eq ($a | $b | $c), 'junction ("a" & "b" & "c") matches junction ($a | $b | $c)');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
77
78 # mix around variables and literals
79
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
80 jok(($a & 'b' & 'c') eq ('a' | $b | $c), 'junction ($a & "b" & "c") matches junction ("a" | $b | $c)');
81 jok(($a & 'b' & $c) eq ('a' | $b | 'c'), 'junction ($a & "b" & $c) matches junction ("a" | $b | "c")');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
82
83 }
84
85 # same tests, but with junctions as variables
86 {
13cc9c4 [t/spec] 71 typos in 32 files.
Util authored
87 # initialize them all to empty strings
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
88 my $a = '';
89 my $b = '';
90 my $c = '';
91
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
92 my Mu $all_of_them = $a & $b & $c;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
93 jok('' eq $all_of_them, 'junction variable of ($a & $b & $c) matches and empty string');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
94
95 $a = 'a';
96
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
97 my Mu $any_of_them = $b | $c | $a;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
98 jok('a' eq $any_of_them, 'junction variable of ($b | $c | $a) matches at least one "a"');
99 jok('' eq $any_of_them, 'junction variable of ($b | $c | $a) matches at least one empty string');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
100
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
101 my Mu $one_of_them = $b ^ $c ^ $a;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
102 jok('a' eq $one_of_them, 'junction variable of ($b ^ $c ^ $a) matches at ~only~ one "a"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
103
104 $b = 'a';
105
106 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
107 my Mu $one_of_them = $b ^ $c ^ $a;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
108 jok('a' ne $one_of_them, 'junction variable of ($b ^ $c ^ $a) matches at more than one "a"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
109 }
110
111 $b = 'b';
112 $c = 'c';
113
114 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
115 my Mu $one_of_them = $b ^ $c ^ $a;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
116 jok('a' eq $one_of_them, 'junction of ($b ^ $c ^ $a) matches at ~only~ one "a"');
117 jok('b' eq $one_of_them, 'junction of ($a ^ $b ^ $c) matches at ~only~ one "b"');
118 jok('c' eq $one_of_them, 'junction of ($c ^ $a ^ $b) matches at ~only~ one "c"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
119 }
120
121 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
122 my Mu $any_of_them = $b | $c | $a;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
123 jok('a' eq $any_of_them, 'junction of ($b | $c | $a) matches at least one "a"');
124 jok('b' eq $any_of_them, 'junction of ($a | $b | $c) matches at least one "b"');
125 jok('c' eq $any_of_them, 'junction of ($c | $a | $b) matches at least one "c"');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
126 }
127
128 }
129
130 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
131 my Mu $j = 1 | 2;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
132 $j = 5;
133 is($j, 5, 'reassignment of junction variable');
134 }
135
136 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
137 my Mu $j;
138 my Mu $k;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
139
140 $j = 1|2;
5278d6a @pmichaud Correct rakudo fudge in S03-junctions/misc.t .
pmichaud authored
141 #?rakudo 2 todo 'lower case junction type'
f85b8bf Fix a bunch of typeobject stringifications.
kboga authored
142 is(WHAT($j).gist, 'Junction()', 'basic junction type reference test');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
143
144 $k=$j;
f85b8bf Fix a bunch of typeobject stringifications.
kboga authored
145 is(WHAT($k).gist, 'Junction()', 'assignment preserves reference');
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
146 }
147
148
149 =begin description
150
151 Tests junction examples from Synopsis 03
152
153 j() is used to convert a junction to canonical string form, currently
154 just using .perl until a better approach presents itself.
155
156 =end description
157
eda6db1 [t/spec] move smartlinks from POD to ordinary comments
moritz authored
158 # L<S03/Junctive operators>
159
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
160 # Canonical stringification of a junction
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
161 sub j (Mu $j) { return $j.perl }
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
162
163 {
164 # L<S03/Junctive operators/They thread through operations>
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
165 my Mu $got;
166 my Mu $want;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
167 $got = ((1|2|3)+4);
168 $want = (5|6|7);
169 is( j($got), j($want), 'thread + returning junctive result');
170
171 $got = ((1|2) + (3&4));
172 $want = ((4|5) & (5|6));
0836cea @coke nom fudging
coke authored
173 #?rakudo todo 'nom regression'
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
174 is( j($got), j($want), 'thread + returning junctive combination of results');
175
176 # L<S03/Junctive operators/This opens doors for constructions like>
177 # unless $roll == any(1..6) { print "Invalid roll" }
648ae66 [spec] fudged S03-junctions/misc.t
moritz authored
178 my $roll;
179 my $note;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
180 $roll = 3; $note = '';
181 unless $roll == any(1..6) { $note = "Invalid roll"; };
182 is($note, "", 'any() junction threading ==');
183
184 $roll = 7; $note = '';
185 unless $roll == any(1..6) { $note = "Invalid roll"; };
186 is($note, "Invalid roll", 'any() junction threading ==');
187
188 # if $roll == 1|2|3 { print "Low roll" }
189 $roll = 4; $note = '';
190 if $roll == 1|2|3 { $note = "Low roll" }
191 is($note, "", '| junction threading ==');
192
193 $roll = 2; $note = '';
194 if $roll == 1|2|3 { $note = "Low roll" }
195 is($note, "Low roll", '| junction threading ==');
d0da223 [spec]: Unfudge some junction tests for Rakudo.
pmichaud authored
196 }
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
197
d0da223 [spec]: Unfudge some junction tests for Rakudo.
pmichaud authored
198 #?rakudo skip 'Junctions as subscripts'
199 {
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
200 # L<S03/Junctive operators/Junctions work through subscripting>
648ae66 [spec] fudged S03-junctions/misc.t
moritz authored
201 my $got;
202 my @foo;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
203 $got = ''; @foo = ();
204 $got ~= 'y' if try { @foo[any(1,2,3)] };
205 is($got, '', "junctions work through subscripting, 0 matches");
206
207 $got = ''; @foo = (0,1);
208 $got ~= 'y' if try { @foo[any(1,2,3)] };
8315f60 @sorear Unfudge and fix tests for junction indexes
sorear authored
209 is($got, 'y', "junctions work through subscripting, 1 match");
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
210
211 $got = ''; @foo = (1,1,1);
212 $got ~= 'y' if try { @foo[any(1,2,3)] };
8315f60 @sorear Unfudge and fix tests for junction indexes
sorear authored
213 is($got, 'y', "junctions work through subscripting, 3 matches");
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
214
215
216 # L<S03/Junctive operators/Junctions are specifically unordered>
217 # Compiler *can* reorder and parallelize but *may not* so don't test
218 # for all(@foo) {...};
219
220 # Not sure what is expected
221 #my %got = ('1' => 1); # Hashes are unordered too
222 #@foo = (2,3,4);
223 #for all(@foo) { %got{$_} = 1; };
224 #is( %got.keys.sort.join(','), '1,2,3,4',
225 # 'for all(...) { ...} as parallelizable');
226 }
227
228 =begin description
229
230 These are implemented but still awaiting clarification on p6l.
231
232 On Fri, 2005-02-11 at 10:46 +1100, Damian Conway wrote:
233 > Subject: Re: Fwd: Junctive puzzles.
234 >
235 > Junctions have an associated boolean predicate that's preserved across
236 > operations on the junction. Junctions also implicitly distribute across
237 > operations, and rejunctify the results.
238
239 =end description
240
eda6db1 [t/spec] move smartlinks from POD to ordinary comments
moritz authored
241 # L<S03/Junctive operators/They thread through operations>
242
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
243 {
244 my @subs = (sub {3}, sub {2});
245
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
246 my Mu $got;
247 my Mu $want;
82ba44c [spec] started to move junction tests (and upate POD). Much more work…
moritz authored
248
249 is(j(any(@subs)()), j(3|2), '.() on any() junction of subs');
250
251 $want = (3&2);
252 $got = all(@subs)();
253 is(j($got), j($want), '.() on all() junction of subs');
254
255 $want = (3^2);
256 $got = one(@subs)();
257 is(j($got), j($want), '.() on one() junction of subs');
258
259 $want = none(3,2);
260 $got = none(@subs)();
261 is(j($got), j($want), '.() on none() junction of subs');
262
263 $want = one( any(3,2), all(3,2) );
264 $got = one( any(@subs), all(@subs) )();
265 is(j($got), j($want), '.() on complex junction of subs');
266
267 # Avoid future constant folding
268 #my $rand = rand;
269 #my $zero = int($rand-$rand);
270 #my @subs = (sub {3+$zero}, sub {2+$zero});
271 }
272
273 # Check functional and operator versions produce the same structure
274 {
275 is(j((1|2)^(3&4)), j(one(any(1,2),all(3,4))),
276 '((1|2)^(3&4)) equiv to one(any(1,2),all(3,4))');
277
278 is(j((1|2)&(3&4)), j(all(any(1,2),all(3,4))),
279 '((1|2)&(3&4)) equiv to all(any(1,2),all(3,4))');
280
281 is(j((1|2)|(3&4)), j(any(any(1,2),all(3,4))),
282 '((1|2)|(3&4)) equiv to any(any(1,2),all(3,4))');
283 }
284
285 # junction in boolean context
286 ok(?(0&0) == ?(0&&0), 'boolean context');
287 ok(?(0&1) == ?(0&&1), 'boolean context');
288 ok(?(1&1) == ?(1&&1), 'boolean context');
289 ok(?(1&0) == ?(1&&0), 'boolean context');
290 ok(!(?(0&0) != ?(0&&0)), 'boolean context');
291 ok(!(?(0&1) != ?(0&&1)), 'boolean context');
292 ok(!(?(1&1) != ?(1&&1)), 'boolean context');
293 ok(!(?(1&0) != ?(1&&0)), 'boolean context');
294
295
296 {
297 my $c = 0;
298 if 1 == 1 { $c++ }
299 is $c, 1;
300 if 1 == 1|2 { $c++ }
301 is $c, 2;
302 if 1 == 1|2|3 { $c++ }
303 is $c, 3;
304
305 $c++ if 1 == 1;
306 is $c, 4;
307 $c++ if 1 == 1|2;
308 is $c, 5, 'if modifier with junction should be called once';
309
310 $c = 0;
311 $c++ if 1 == 1|2|3;
312 is $c, 1, 'if modifier with junction should be called once';
313
314 $c = 0;
315 $c++ if 1 == any(1, 2, 3);
316 is $c, 1, 'if modifier with junction should be called once';
317 }
57e7ad8 [t] move some junction tests
moritz authored
318
319 {
320 my @array = <1 2 3 4 5 6 7 8>;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
321 jok( all(@array) == one(@array), "all(@x) == one(@x) tests uniqueness(+ve)" );
57e7ad8 [t] move some junction tests
moritz authored
322
323 push @array, 6;
e97f6d5 [t/spec] avoid autohreading through ok()
moritz authored
324 jok( !( all(@array) == one(@array) ), "all(@x) == one(@x) tests uniqueness(-ve)" );
57e7ad8 [t] move some junction tests
moritz authored
325
326 }
1c00622 [t/spec] test for RT #60886
moritz authored
327
328 # used to be a rakudo regression (RT #60886)
f2f0e24 [t/spec] A little re-fudging that I forgot to commit earlier.
jnthn authored
329 ok Mu & Mu ~~ Mu, 'Mu & Mu ~~ Mu works';
310944a test substr on junctions
szabgab authored
330
d4cdad3 testing index() with junction
szabgab authored
331 ## See also S03-junctions/autothreading.t
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
332 #?rakudo skip 'substr on junctions'
310944a test substr on junctions
szabgab authored
333 {
334 is substr("abcd", 1, 2), "bc", "simple substr";
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
335 my Mu $res = substr(any("abcd", "efgh"), 1, 2);
336 isa_ok $res, Junction;
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
337 ok $res eq "bc", "substr on junctions: bc";
338 ok $res eq "fg", "substr on junctions: fg";
310944a test substr on junctions
szabgab authored
339 }
340
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
341 #?rakudo skip 'substr on junctions'
310944a test substr on junctions
szabgab authored
342 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
343 my Mu $res = substr("abcd", 1|2, 2);
344 isa_ok $res, Junction;
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
345 ok $res eq "bc", "substr on junctions: bc";
346 ok $res eq "cd", "substr on junctions: cd";
310944a test substr on junctions
szabgab authored
347 }
348
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
349 #?rakudo skip 'substr on junctions'
310944a test substr on junctions
szabgab authored
350 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
351 my Mu $res = substr("abcd", 1, 1|2);
352 isa_ok $res, Junction;
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
353 ok $res eq "bc", "substr on junctions: bc";
354 ok $res eq "b", "substr on junctions: b";
310944a test substr on junctions
szabgab authored
355 }
356
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
357 #?rakudo skip 'index on junctions'
d4cdad3 testing index() with junction
szabgab authored
358 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
359 my Mu $res = index(any("abcd", "qwebdd"), "b");
360 isa_ok $res, Junction;
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
361 ok $res == 1, "index on junctions: 1";
362 ok $res == 3, "index on junctions: 3";
d4cdad3 testing index() with junction
szabgab authored
363 }
364
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
365 #?rakudo skip 'index on junctions'
d4cdad3 testing index() with junction
szabgab authored
366 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
367 my Mu $res = index("qwebdd", "b"|"w");
368 isa_ok $res, Junction;
ffa7511 [t/spec/] "Junction" -> "junction", ".eigenstates" -> "!eigenstates" …
Kodi authored
369 ok $res == 1, "index on junctions: 1";
370 ok $res == 3, "index on junctions: 3";
d4cdad3 testing index() with junction
szabgab authored
371 }
372
30c8e17 [t/spec] (perhaps incomplete) test for RT #63686
kyle authored
373 # RT #63686
374 {
375 lives_ok { try { for any(1,2) -> $x {}; } },
376 'for loop over junction in try block';
26751c8 naive implementation of comparing two junctions
szabgab authored
377
30c8e17 [t/spec] (perhaps incomplete) test for RT #63686
kyle authored
378 sub rt63686 {
8dc7d4b [t/spec] mark various tests that intentionally declare things that ar…
lwall authored
379 for any(1,2) -> $x {}; #OK not used
30c8e17 [t/spec] (perhaps incomplete) test for RT #63686
kyle authored
380 return 'happiness';
381 }
382 is rt63686(), 'happiness', 'for loop over junction in sub';
383 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
384
3c2bc42 * add tests for RT#67866
smash authored
385 # RT#67866: [BUG] [LHF] Error with stringifying .WHAT on any junctions
8d4ec02 [t/spec] remove some junction tests that relied on internal methods; …
moritz authored
386 #?rakudo skip 'lower case junction'
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
387 #?niecza skip 'Impossible test: === takes Any'
3c2bc42 * add tests for RT#67866
smash authored
388 {
97213bc @sorear Fudge and defossilize S03-junctions/misc
sorear authored
389 ok((WHAT any()) === Junction, "test WHAT on empty any junction");
390 ok(any().WHAT === Junction, "test WHAT on empty any junction");
391 ok((WHAT any(1,2)) === Junction, "test WHAT on any junction");
392 ok(any(1,2).WHAT === Junction, "test WHAT on any junction");
3c2bc42 * add tests for RT#67866
smash authored
393 }
4f9deaa RT#75626 tests - Implement Any.all (and .any, .one, .none) in Rakudo
mmcleric authored
394
395 # Any list has junction methods
396 {
397 jok(5 < (6,7,8).all, '.all method builds "all" junction');
398 jok(!(7 < (6,7,8).all), '.all method builds "all" junction');
399 jok(7 == (6,7,8).one, '.one method builds "one" junction');
400 jok(9 == (6,7,8).none, '.none method builds "none" junction');
401
402 my @x = (6,7,8);
403 jok(5 < @x.all, '.all method works on array objects');
404 }
09302fd [t/spec] tests for RT #63126 Junctions in array and hash indices dont…
bbkr authored
405
406 # RT #63126
0836cea @coke nom fudging
coke authored
407 #?rakudo skip 'nom regression'
408 #?DOES 2
09302fd [t/spec] tests for RT #63126 Junctions in array and hash indices dont…
bbkr authored
409 {
410 my @a = "foo", "foot";
411 ok @a[all(0,1)] ~~ /^foo/,
412 'junction can be used to index Array';
413
414 my %h = (
415 "0" => "foo",
416 "1" => "foot"
417 );
418 ok %h{all(0,1)} ~~ /^foo/,
419 'junction can be used to index Hash';
420 }
421
e76dd4c @moritz s/done_testing/done/ as per recent S24 changes
moritz authored
422 done();
3c2bc42 * add tests for RT#67866
smash authored
423
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
424 # vim: ft=perl6
Something went wrong with that request. Please try again.