Skip to content

HTTPS clone URL

Subversion checkout URL

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