Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 82 lines (68 sloc) 3.759 kb
0874033c » moritz
2008-09-26 [t/spec] moved multi_named_vs_pos.t to spec/
1 use v6;
2 use Test;
e2961159 » moritz
2012-02-03 RT #78738, dispatch of multis with empty and with mandatory named params
3 plan 27;
0874033c » moritz
2008-09-26 [t/spec] moved multi_named_vs_pos.t to spec/
4
5 # check the subroutine with the closest matching signature is called
6 #
7 #L<S06/"Longname parameters">
8 #L<S12/"Multisubs and Multimethods">
9
198d3539 » ron
2009-04-28 documented some tests and added some tests for RT #53814
10 # the single parameter cases named and positional below - part of RT 53814
11
0058a898 » moritz
2011-05-21 remove ambiguous cases from positional-vs-named.t, fudge for rakudo
12 multi earth (:$me!) {"me $me"};
13 multi earth (:$him!) {"him $him"};
14 multi earth (:$me!, :$him!) {"me $me him $him"};
15 multi earth (:$me!, :$him!, :$her!) {"me $me him $him her $her"};
16 multi earth ($me) {"pos $me"};
17 multi earth ($me, :$you!) {"pos $me you $you"};
18 multi earth ($me, :$her!) {"pos $me her $her"};
19 multi earth ($me, $you) {"pos $me pos $you"};
20 multi earth ($me, $you, :$her!) {"pos $me pos $you her $her"};
0874033c » moritz
2008-09-26 [t/spec] moved multi_named_vs_pos.t to spec/
21
22 is( earth(me => 1), 'me 1', 'named me');
23 is( earth(him => 2), 'him 2', 'named you');
24 is( earth(me => 1, him => 2), 'me 1 him 2', 'named me, named him');
25 is( earth(him => 2, me => 1), 'me 1 him 2', 'named him, named me');
26 is( earth(me => 1, him => 2, her => 3), 'me 1 him 2 her 3', 'named me named him named her');
27 is( earth(him => 2, me => 1, her => 3), 'me 1 him 2 her 3', 'named him named me named her');
28 is( earth(her => 3, me => 1, him => 2), 'me 1 him 2 her 3', 'named her named me named him');
29 is( earth(her => 3, him => 2, me => 1), 'me 1 him 2 her 3', 'named her named him named me');
30
31 is( earth('b', you => 4), 'pos b you 4', 'pos, named you');
32 is( earth('c', her => 3), 'pos c her 3', 'pos, named her');
33 is( earth('d', 'e'), 'pos d pos e', 'pos, pos');
34 is( earth('f', 'g', her => 3), 'pos f pos g her 3', 'pos, pos, named');
35
36
37 # ensure we get the same results when the subroutines are
38 # defined in reverse order
39 #
40
0058a898 » moritz
2011-05-21 remove ambiguous cases from positional-vs-named.t, fudge for rakudo
41 multi wind ($me, $you, :$her!) {"pos $me pos $you her $her"};
42 multi wind ($me, $you) {"pos $me pos $you"};
43 multi wind ($me, :$her!) {"pos $me her $her"};
44 multi wind ($me, :$you!) {"pos $me you $you"};
45 multi wind (:$me!, :$him!, :$her!) {"me $me him $him her $her"};
46 multi wind (:$me!, :$him!) {"me $me him $him"};
47 multi wind (:$him) {"him $him"};
48 multi wind (:$me) {"me $me"};
0874033c » moritz
2008-09-26 [t/spec] moved multi_named_vs_pos.t to spec/
49
50 is( wind(me => 1), 'me 1', 'named me');
51 is( wind(him => 2), 'him 2', 'named you');
52 is( wind(me => 1, him => 2), 'me 1 him 2', 'named me, named him');
53 is( wind(him => 2, me => 1), 'me 1 him 2', 'named him, named me');
54 is( wind(me => 1, him => 2, her => 3), 'me 1 him 2 her 3', 'named me named him named her');
55 is( wind(him => 2, me => 1, her => 3), 'me 1 him 2 her 3', 'named him named me named her');
56 is( wind(her => 3, me => 1, him => 2), 'me 1 him 2 her 3', 'named her named me named him');
57 is( wind(her => 3, him => 2, me => 1), 'me 1 him 2 her 3', 'named her named him named me');
58
59 is( wind('b', you => 4), 'pos b you 4', 'pos, named you');
60 is( wind('c', her => 3), 'pos c her 3', 'pos, named her');
61 is( wind('d', 'e'), 'pos d pos e', 'pos, pos');
62 is( wind('f', 'g', her => 3), 'pos f pos g her 3', 'pos, pos, named');
63
487c5f9b » moritz
2011-08-13 [multi] test interaction of slurpy positional and mandatory named param
64 #?rakudo skip 'slurpy and named interaction'
65 {
66 # a nom bug
89f0409e » TimToady
2012-09-03 warning suppression, mostly "not used"
67 multi catch(*@all ) { 1 } #OK not used
68 multi catch(*@all, :$really! ) { 2 } #OK not used
487c5f9b » moritz
2011-08-13 [multi] test interaction of slurpy positional and mandatory named param
69 is catch(0, 5), 1, 'slurpy and named interact well (1)';
70 is catch(0, 5, :!really), 2, 'slurpy and named interact well (2)';
71 }
72
e2961159 » moritz
2012-02-03 RT #78738, dispatch of multis with empty and with mandatory named params
73 # RT #78738
74 {
75 multi zero() { 'no args' };
76 multi zero(:$foo!) { 'named' };
77 is zero(), 'no args',
78 'presence of mandatory named multi does not corrupt calling a nullary'
79 }
80
7f29bc53 » kyle
2009-08-08 [t/spec] Add vim: lines everywhere.
81
82 # vim: ft=perl6
Something went wrong with that request. Please try again.