@@ -19,6 +19,7 @@ multi sub bar($a) { "one" } #OK not used
19
19
# ?niecza skip 'No candidates for dispatch to &bar'
20
20
is (bar(), " empty" , " multi sub with no signature" );
21
21
# ?niecza skip 'Ambiguous dispatch for &bar'
22
+ # ?pugs todo
22
23
is (bar(42 ), " one" , " multi sub with parameter list" );
23
24
24
25
# multi without a routine type
@@ -27,6 +28,7 @@ multi baz($a) { "one" } #OK not used
27
28
# ?niecza skip 'No candidates for dispatch to &baz'
28
29
is (baz(), " empty" , " multi with no signature" );
29
30
# ?niecza skip 'Ambiguous dispatch for &baz'
31
+ # ?pugs todo
30
32
is (baz(42 ), " one" , " multi with parameter list" );
31
33
32
34
# multi without a routine type with signature
@@ -48,8 +50,10 @@ multi bar(S $a;; T $b) { 1 } #OK not used
48
50
multi bar (T $ a ;; S $b) { 2 } # OK not used
49
51
my $lived = 0 ;
50
52
try { foo(S,S); $ lived = 1 }
53
+ # ?pugs todo
51
54
is ($ lived , 0 , " dispatch tied as expected" );
52
55
# ?niecza skip 'Ambiguous dispatch for &bar'
56
+ # ?pugs skip 'missing invocant'
53
57
is (bar(S,S), 1 , " not tied as only first type in the dispatch" );
54
58
55
59
# not allowed to declare anonymous routines with only, multi or proto.
@@ -68,16 +72,20 @@ eval_dies_ok 'class C { proto method {} }', 'anonymous proto method is an error'
68
72
69
73
# ?rakudo skip 'Multi typename...maybe deprecated?'
70
74
# ?niecza skip 'Undeclared name Multi'
75
+ # ?pugs skip 'Undeclared name Multi'
71
76
ok (& foo ~~ Multi, ' a multi does Multi' );
77
+ # ?pugs skip 'Callable'
72
78
ok (& foo ~~ Callable , ' a multi does Callable' );
73
79
# ?niecza todo
80
+ # ?pugs skip 'parsefail'
74
81
ok (~ & foo ~~ /foo /, ' a multi stringifies sensibly' );
75
82
76
83
# note - example in ticket [perl #58948] a bit more elaborate
77
84
{
78
85
multi sub max ($ a , $ b , $ c ) {return 9 } # OK not used
79
86
80
87
lives_ok { max (1 , 2 , 3 ) }, ' use multi method to override builtin lives' ;
88
+ # ?pugs todo
81
89
is eval(' max(1, 2, 3)' ), 9 , ' use multi method to override builtin' ;
82
90
}
83
91
@@ -96,19 +104,23 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
96
104
{
97
105
multi rt68234 (: $ key ! ) { ' with key' }; # OK not used
98
106
multi rt68234 (* % _ ) { ' unknown' }; # OK not used
107
+ # ?pugs todo
99
108
is rt68234(: key), ' with key' , ' can find multi method with key' ;
109
+ # ?pugs skip 'Named argument found where no matched parameter expected'
100
110
is rt68234(: unknown), ' unknown' , ' can find multi method with slurpy' ;
101
111
}
102
112
103
113
# RT #68158
104
114
{
105
115
multi rt68158 () { 1 }
106
116
multi rt68158 (* @ x ) { 2 } # OK not used
117
+ # ?pugs todo
107
118
is rt68158(), 1 , ' non-slurpy wins over slurpy' ;
108
119
is rt68158(9 ), 2 , ' slurpy called when non-slurpy can not bind' ;
109
120
}
110
121
111
122
# RT #64922
123
+ # ?pugs todo
112
124
{
113
125
multi rt64922 ($ x , % h ? ) { 1 } # OK not used
114
126
multi rt64922 (@ x ) { 2 } # OK not used
@@ -126,6 +138,7 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
126
138
127
139
# We had a bug where the multiness leaked into a sub, so we got errors
128
140
# about anonymous methods not being allowed to be multi.
141
+ # ?pugs skip 'parsefail'
129
142
{
130
143
multi sub kangaroo () { return method () { self * 2 } }
131
144
my $ m = kangaroo();
@@ -136,6 +149,7 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
136
149
# RT #75136
137
150
# a multi declaration should only return the current candidate, not the whole
138
151
# set of candidates.
152
+ # ?pugs skip 'parsefail'
139
153
{
140
154
multi sub koala (Int $ x ) { 42 * $ x };
141
155
@@ -148,6 +162,7 @@ ok(~&foo ~~ /foo/, 'a multi stringifies sensibly');
148
162
149
163
multi with_cap ($ a ) { $ a }
150
164
multi with_cap ($ a ,$ b ,| $ cap ) { return with_cap($ a + $ b , | $ cap ) }
165
+ # ?pugs skip 'with_cap not found'
151
166
is with_cap(1 ,2 ,3 ,4 ,5 ,6 ), 21 , ' captures in multi sigs work' ;
152
167
153
168
done ;
0 commit comments