Skip to content

HTTPS clone URL

Subversion checkout URL

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