This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test line numbers in arity errors
[perl5.git] / t / op / signatures.t
CommitLineData
30d9c59b
Z
1#!perl
2
3BEGIN {
a817e89d 4 chdir 't' if -d 't';
30d9c59b 5 require './test.pl';
1ccc3f31 6 set_up_inc('../lib');
30d9c59b 7}
30d9c59b
Z
8
9eval "#line 8 foo\nsub t004 :method (\$a) { }";
10is $@, "Experimental subroutine signatures not enabled at foo line 8\.\n",
11 "error when not enabled";
12
13eval "#line 8 foo\nsub t005 (\$) (\$a) { }";
14is $@, "Experimental subroutine signatures not enabled at foo line 8\.\n",
15 "error when not enabled";
16
17no warnings "illegalproto";
18
19our $a = 123;
20our $z;
21
22sub t000 ($a) { $a || "z" }
23is prototype(\&t000), "\$a", "(\$a) interpreted as protoype when not enabled";
24is &t000(456), 123, "(\$a) not signature when not enabled";
25is $a, 123;
26
27no warnings "experimental::signatures";
28use feature "signatures";
29
30sub t001 { $a || "z" }
31is prototype(\&t001), undef;
32is eval("t001()"), 123;
33is eval("t001(456)"), 123;
34is eval("t001(456, 789)"), 123;
35is $a, 123;
36
37sub t002 () { $a || "z" }
38is prototype(\&t002), undef;
39is eval("t002()"), 123;
40is eval("t002(456)"), undef;
aff539aa 41like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 42is eval("t002(456, 789)"), undef;
aff539aa 43like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
44is $a, 123;
45
46sub t003 ( ) { $a || "z" }
47is prototype(\&t003), undef;
48is eval("t003()"), 123;
49is eval("t003(456)"), undef;
aff539aa 50like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 51is eval("t003(456, 789)"), undef;
aff539aa 52like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
53is $a, 123;
54
55sub t006 ($a) { $a || "z" }
56is prototype(\&t006), undef;
57is eval("t006()"), undef;
aff539aa 58like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
59is eval("t006(0)"), "z";
60is eval("t006(456)"), 456;
61is eval("t006(456, 789)"), undef;
aff539aa 62like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 63is eval("t006(456, 789, 987)"), undef;
aff539aa 64like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
65is $a, 123;
66
67sub t007 ($a, $b) { $a.$b }
68is prototype(\&t007), undef;
69is eval("t007()"), undef;
aff539aa 70like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 71is eval("t007(456)"), undef;
aff539aa 72like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
73is eval("t007(456, 789)"), "456789";
74is eval("t007(456, 789, 987)"), undef;
aff539aa 75like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 76is eval("t007(456, 789, 987, 654)"), undef;
aff539aa 77like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
78is $a, 123;
79
80sub t008 ($a, $b, $c) { $a.$b.$c }
81is prototype(\&t008), undef;
82is eval("t008()"), undef;
aff539aa 83like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 84is eval("t008(456)"), undef;
aff539aa 85like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 86is eval("t008(456, 789)"), undef;
aff539aa 87like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
88is eval("t008(456, 789, 987)"), "456789987";
89is eval("t008(456, 789, 987, 654)"), undef;
aff539aa 90like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
91is $a, 123;
92
93sub t009 ($abc, $def) { $abc.$def }
94is prototype(\&t009), undef;
95is eval("t009()"), undef;
aff539aa 96like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 97is eval("t009(456)"), undef;
aff539aa 98like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
99is eval("t009(456, 789)"), "456789";
100is eval("t009(456, 789, 987)"), undef;
aff539aa 101like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 102is eval("t009(456, 789, 987, 654)"), undef;
aff539aa 103like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
104is $a, 123;
105
106sub t010 ($a, $) { $a || "z" }
107is prototype(\&t010), undef;
108is eval("t010()"), undef;
aff539aa 109like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 110is eval("t010(456)"), undef;
aff539aa 111like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
112is eval("t010(0, 789)"), "z";
113is eval("t010(456, 789)"), 456;
114is eval("t010(456, 789, 987)"), undef;
aff539aa 115like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 116is eval("t010(456, 789, 987, 654)"), undef;
aff539aa 117like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
118is $a, 123;
119
120sub t011 ($, $a) { $a || "z" }
121is prototype(\&t011), undef;
122is eval("t011()"), undef;
aff539aa 123like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 124is eval("t011(456)"), undef;
aff539aa 125like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
126is eval("t011(456, 0)"), "z";
127is eval("t011(456, 789)"), 789;
128is eval("t011(456, 789, 987)"), undef;
aff539aa 129like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 130is eval("t011(456, 789, 987, 654)"), undef;
aff539aa 131like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
132is $a, 123;
133
134sub t012 ($, $) { $a || "z" }
135is prototype(\&t012), undef;
136is eval("t012()"), undef;
aff539aa 137like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 138is eval("t012(456)"), undef;
aff539aa 139like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
140is eval("t012(0, 789)"), 123;
141is eval("t012(456, 789)"), 123;
142is eval("t012(456, 789, 987)"), undef;
aff539aa 143like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 144is eval("t012(456, 789, 987, 654)"), undef;
aff539aa 145like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
146is $a, 123;
147
148sub t013 ($) { $a || "z" }
149is prototype(\&t013), undef;
150is eval("t013()"), undef;
aff539aa 151like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
152is eval("t013(0)"), 123;
153is eval("t013(456)"), 123;
154is eval("t013(456, 789)"), undef;
aff539aa 155like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 156is eval("t013(456, 789, 987)"), undef;
aff539aa 157like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 158is eval("t013(456, 789, 987, 654)"), undef;
aff539aa 159like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
160is $a, 123;
161
162sub t014 ($a = 222) { $a // "z" }
163is prototype(\&t014), undef;
164is eval("t014()"), 222;
165is eval("t014(0)"), 0;
166is eval("t014(undef)"), "z";
167is eval("t014(456)"), 456;
168is eval("t014(456, 789)"), undef;
aff539aa 169like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 170is eval("t014(456, 789, 987)"), undef;
aff539aa 171like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
172is $a, 123;
173
174sub t015 ($a = undef) { $a // "z" }
175is prototype(\&t015), undef;
176is eval("t015()"), "z";
177is eval("t015(0)"), 0;
178is eval("t015(undef)"), "z";
179is eval("t015(456)"), 456;
180is eval("t015(456, 789)"), undef;
aff539aa 181like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 182is eval("t015(456, 789, 987)"), undef;
aff539aa 183like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
184is $a, 123;
185
186sub t016 ($a = do { $z++; 222 }) { $a // "z" }
187$z = 0;
188is prototype(\&t016), undef;
189is eval("t016()"), 222;
190is $z, 1;
191is eval("t016(0)"), 0;
192is eval("t016(undef)"), "z";
193is eval("t016(456)"), 456;
194is eval("t016(456, 789)"), undef;
aff539aa 195like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 196is eval("t016(456, 789, 987)"), undef;
aff539aa 197like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
198is $z, 1;
199is eval("t016()"), 222;
200is $z, 2;
201is $a, 123;
202
203sub t018 { join("/", @_) }
204sub t017 ($p = t018 222, $a = 333) { $p // "z" }
205is prototype(\&t017), undef;
206is eval("t017()"), "222/333";
207is $a, 333;
208$a = 123;
209is eval("t017(0)"), 0;
210is eval("t017(undef)"), "z";
211is eval("t017(456)"), 456;
212is eval("t017(456, 789)"), undef;
aff539aa 213like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 214is eval("t017(456, 789, 987)"), undef;
aff539aa 215like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
216is $a, 123;
217
218sub t019 ($p = 222, $a = 333) { "$p/$a" }
219is prototype(\&t019), undef;
220is eval("t019()"), "222/333";
221is eval("t019(0)"), "0/333";
222is eval("t019(456)"), "456/333";
223is eval("t019(456, 789)"), "456/789";
224is eval("t019(456, 789, 987)"), undef;
aff539aa 225like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
226is $a, 123;
227
228sub t020 :prototype($) { $_[0]."z" }
229sub t021 ($p = t020 222, $a = 333) { "$p/$a" }
230is prototype(\&t021), undef;
231is eval("t021()"), "222z/333";
232is eval("t021(0)"), "0/333";
233is eval("t021(456)"), "456/333";
234is eval("t021(456, 789)"), "456/789";
235is eval("t021(456, 789, 987)"), undef;
aff539aa 236like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
237is $a, 123;
238
239sub t022 ($p = do { $z += 10; 222 }, $a = do { $z++; 333 }) { "$p/$a" }
240$z = 0;
241is prototype(\&t022), undef;
242is eval("t022()"), "222/333";
243is $z, 11;
244is eval("t022(0)"), "0/333";
245is $z, 12;
246is eval("t022(456)"), "456/333";
247is $z, 13;
248is eval("t022(456, 789)"), "456/789";
249is eval("t022(456, 789, 987)"), undef;
aff539aa 250like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
251is $z, 13;
252is $a, 123;
253
254sub t023 ($a = sub { $_[0]."z" }) { $a->("a")."y" }
255is prototype(\&t023), undef;
256is eval("t023()"), "azy";
257is eval("t023(sub { \"x\".\$_[0].\"x\" })"), "xaxy";
258is eval("t023(sub { \"x\".\$_[0].\"x\" }, 789)"), undef;
aff539aa 259like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
260is $a, 123;
261
262sub t036 ($a = $a."x") { $a."y" }
263is prototype(\&t036), undef;
264is eval("t036()"), "123xy";
265is eval("t036(0)"), "0y";
266is eval("t036(456)"), "456y";
267is eval("t036(456, 789)"), undef;
aff539aa 268like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
269is $a, 123;
270
acf0afbd
Z
271sub t120 ($a = $_) { $a // "z" }
272is prototype(\&t120), undef;
273$_ = "___";
274is eval("t120()"), "___";
275$_ = "___";
276is eval("t120(undef)"), "z";
277$_ = "___";
278is eval("t120(0)"), 0;
279$_ = "___";
280is eval("t120(456)"), 456;
281$_ = "___";
282is eval("t120(456, 789)"), undef;
aff539aa 283like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
284is $a, 123;
285
286sub t121 ($a = caller) { $a // "z" }
287is prototype(\&t121), undef;
288is eval("t121()"), "main";
289is eval("t121(undef)"), "z";
290is eval("t121(0)"), 0;
291is eval("t121(456)"), 456;
292is eval("t121(456, 789)"), undef;
aff539aa 293like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
294is eval("package T121::Z; ::t121()"), "T121::Z";
295is eval("package T121::Z; ::t121(undef)"), "z";
296is eval("package T121::Z; ::t121(0)"), 0;
297is eval("package T121::Z; ::t121(456)"), 456;
298is eval("package T121::Z; ::t121(456, 789)"), undef;
aff539aa 299like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
300is $a, 123;
301
302sub t129 ($a = return 222) { $a."x" }
303is prototype(\&t129), undef;
304is eval("t129()"), "222";
305is eval("t129(0)"), "0x";
306is eval("t129(456)"), "456x";
307is eval("t129(456, 789)"), undef;
aff539aa 308like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
309is $a, 123;
310
311use feature "current_sub";
312sub t122 ($c = 5, $r = $c > 0 ? __SUB__->($c - 1) : "") { $c.$r }
313is prototype(\&t122), undef;
314is eval("t122()"), "543210";
315is eval("t122(0)"), "0";
316is eval("t122(1)"), "10";
317is eval("t122(5)"), "543210";
318is eval("t122(5, 789)"), "5789";
319is eval("t122(5, 789, 987)"), undef;
aff539aa 320like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
321is $a, 123;
322
323sub t123 ($list = wantarray) { $list ? "list" : "scalar" }
324is prototype(\&t123), undef;
325is eval("scalar(t123())"), "scalar";
326is eval("(t123())[0]"), "list";
327is eval("scalar(t123(0))"), "scalar";
328is eval("(t123(0))[0]"), "scalar";
329is eval("scalar(t123(1))"), "list";
330is eval("(t123(1))[0]"), "list";
331is eval("t123(456, 789)"), undef;
aff539aa 332like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
333is $a, 123;
334
335sub t124 ($b = (local $a = $a + 1)) { "$a/$b" }
336is prototype(\&t124), undef;
337is eval("t124()"), "124/124";
338is $a, 123;
339is eval("t124(456)"), "123/456";
340is $a, 123;
341is eval("t124(456, 789)"), undef;
aff539aa 342like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
343is $a, 123;
344
345sub t125 ($c = (our $t125_counter)++) { $c }
346is prototype(\&t125), undef;
347is eval("t125()"), 0;
348is eval("t125()"), 1;
349is eval("t125()"), 2;
350is eval("t125(456)"), 456;
351is eval("t125(789)"), 789;
352is eval("t125()"), 3;
353is eval("t125()"), 4;
354is eval("t125(456, 789)"), undef;
aff539aa 355like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
356is $a, 123;
357
358use feature "state";
359sub t126 ($c = (state $s = $z++)) { $c }
360is prototype(\&t126), undef;
361$z = 222;
362is eval("t126(456)"), 456;
363is $z, 222;
364is eval("t126()"), 222;
365is $z, 223;
366is eval("t126(456)"), 456;
367is $z, 223;
368is eval("t126()"), 222;
369is $z, 223;
370is eval("t126(456, 789)"), undef;
aff539aa 371like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
372is $z, 223;
373is $a, 123;
374
375sub t127 ($c = do { state $s = $z++; $s++ }) { $c }
376is prototype(\&t127), undef;
377$z = 222;
378is eval("t127(456)"), 456;
379is $z, 222;
380is eval("t127()"), 222;
381is $z, 223;
382is eval("t127()"), 223;
383is eval("t127()"), 224;
384is $z, 223;
385is eval("t127(456)"), 456;
386is eval("t127(789)"), 789;
387is eval("t127()"), 225;
388is eval("t127()"), 226;
389is eval("t127(456, 789)"), undef;
aff539aa 390like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
391is $z, 223;
392is $a, 123;
393
30d9c59b
Z
394sub t037 ($a = 222, $b = $a."x") { "$a/$b" }
395is prototype(\&t037), undef;
396is eval("t037()"), "222/222x";
397is eval("t037(0)"), "0/0x";
398is eval("t037(456)"), "456/456x";
399is eval("t037(456, 789)"), "456/789";
400is eval("t037(456, 789, 987)"), undef;
aff539aa 401like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
402is $a, 123;
403
acf0afbd
Z
404sub t128 ($a = 222, $b = ($a = 333)) { "$a/$b" }
405is prototype(\&t128), undef;
406is eval("t128()"), "333/333";
407is eval("t128(0)"), "333/333";
408is eval("t128(456)"), "333/333";
409is eval("t128(456, 789)"), "456/789";
410is eval("t128(456, 789, 987)"), undef;
aff539aa 411like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
412is $a, 123;
413
414sub t130 { join(",", @_).";".scalar(@_) }
415sub t131 ($a = 222, $b = goto &t130) { "$a/$b" }
416is prototype(\&t131), undef;
417is eval("t131()"), ";0";
418is eval("t131(0)"), "0;1";
419is eval("t131(456)"), "456;1";
420is eval("t131(456, 789)"), "456/789";
421is eval("t131(456, 789, 987)"), undef;
aff539aa 422like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
acf0afbd
Z
423is $a, 123;
424
30d9c59b
Z
425eval "#line 8 foo\nsub t024 (\$a =) { }";
426is $@, "Optional parameter lacks default expression at foo line 8\.\n";
427
428sub t025 ($ = undef) { $a // "z" }
429is prototype(\&t025), undef;
430is eval("t025()"), 123;
431is eval("t025(0)"), 123;
432is eval("t025(456)"), 123;
433is eval("t025(456, 789)"), undef;
aff539aa 434like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 435is eval("t025(456, 789, 987)"), undef;
aff539aa 436like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 437is eval("t025(456, 789, 987, 654)"), undef;
aff539aa 438like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
439is $a, 123;
440
441sub t026 ($ = 222) { $a // "z" }
442is prototype(\&t026), undef;
443is eval("t026()"), 123;
444is eval("t026(0)"), 123;
445is eval("t026(456)"), 123;
446is eval("t026(456, 789)"), undef;
aff539aa 447like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 448is eval("t026(456, 789, 987)"), undef;
aff539aa 449like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 450is eval("t026(456, 789, 987, 654)"), undef;
aff539aa 451like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
452is $a, 123;
453
454sub t032 ($ = do { $z++; 222 }) { $a // "z" }
455$z = 0;
456is prototype(\&t032), undef;
457is eval("t032()"), 123;
458is $z, 1;
459is eval("t032(0)"), 123;
460is eval("t032(456)"), 123;
461is eval("t032(456, 789)"), undef;
aff539aa 462like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 463is eval("t032(456, 789, 987)"), undef;
aff539aa 464like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 465is eval("t032(456, 789, 987, 654)"), undef;
aff539aa 466like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
467is $z, 1;
468is $a, 123;
469
470sub t027 ($ =) { $a // "z" }
471is prototype(\&t027), undef;
472is eval("t027()"), 123;
473is eval("t027(0)"), 123;
474is eval("t027(456)"), 123;
475is eval("t027(456, 789)"), undef;
aff539aa 476like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 477is eval("t027(456, 789, 987)"), undef;
aff539aa 478like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 479is eval("t027(456, 789, 987, 654)"), undef;
aff539aa 480like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
481is $a, 123;
482
483sub t119 ($ =, $a = 333) { $a // "z" }
484is prototype(\&t119), undef;
485is eval("t119()"), 333;
486is eval("t119(0)"), 333;
487is eval("t119(456)"), 333;
488is eval("t119(456, 789)"), 789;
489is eval("t119(456, 789, 987)"), undef;
aff539aa 490like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 491is eval("t119(456, 789, 987, 654)"), undef;
aff539aa 492like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
493is $a, 123;
494
495sub t028 ($a, $b = 333) { "$a/$b" }
496is prototype(\&t028), undef;
497is eval("t028()"), undef;
aff539aa 498like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
499is eval("t028(0)"), "0/333";
500is eval("t028(456)"), "456/333";
501is eval("t028(456, 789)"), "456/789";
502is eval("t028(456, 789, 987)"), undef;
aff539aa 503like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
504is $a, 123;
505
506sub t045 ($a, $ = 333) { "$a/" }
507is prototype(\&t045), undef;
508is eval("t045()"), undef;
aff539aa 509like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
510is eval("t045(0)"), "0/";
511is eval("t045(456)"), "456/";
512is eval("t045(456, 789)"), "456/";
513is eval("t045(456, 789, 987)"), undef;
aff539aa 514like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
515is $a, 123;
516
517sub t046 ($, $b = 333) { "$a/$b" }
518is prototype(\&t046), undef;
519is eval("t046()"), undef;
aff539aa 520like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
521is eval("t046(0)"), "123/333";
522is eval("t046(456)"), "123/333";
523is eval("t046(456, 789)"), "123/789";
524is eval("t046(456, 789, 987)"), undef;
aff539aa 525like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
526is $a, 123;
527
528sub t047 ($, $ = 333) { "$a/" }
529is prototype(\&t047), undef;
530is eval("t047()"), undef;
aff539aa 531like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
532is eval("t047(0)"), "123/";
533is eval("t047(456)"), "123/";
534is eval("t047(456, 789)"), "123/";
535is eval("t047(456, 789, 987)"), undef;
aff539aa 536like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
537is $a, 123;
538
539sub t029 ($a, $b, $c = 222, $d = 333) { "$a/$b/$c/$d" }
540is prototype(\&t029), undef;
541is eval("t029()"), undef;
aff539aa 542like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 543is eval("t029(0)"), undef;
aff539aa 544like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 545is eval("t029(456)"), undef;
aff539aa 546like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
547is eval("t029(456, 789)"), "456/789/222/333";
548is eval("t029(456, 789, 987)"), "456/789/987/333";
549is eval("t029(456, 789, 987, 654)"), "456/789/987/654";
550is eval("t029(456, 789, 987, 654, 321)"), undef;
aff539aa 551like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 552is eval("t029(456, 789, 987, 654, 321, 111)"), undef;
aff539aa 553like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
554is $a, 123;
555
556sub t038 ($a, $b = $a."x") { "$a/$b" }
557is prototype(\&t038), undef;
558is eval("t038()"), undef;
aff539aa 559like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
560is eval("t038(0)"), "0/0x";
561is eval("t038(456)"), "456/456x";
562is eval("t038(456, 789)"), "456/789";
563is eval("t038(456, 789, 987)"), undef;
aff539aa 564like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
565is $a, 123;
566
567eval "#line 8 foo\nsub t030 (\$a = 222, \$b) { }";
568is $@, "Mandatory parameter follows optional parameter at foo line 8\.\n";
569
570eval "#line 8 foo\nsub t031 (\$a = 222, \$b = 333, \$c, \$d) { }";
571is $@, "Mandatory parameter follows optional parameter at foo line 8\.\n";
572
573sub t034 (@abc) { join("/", @abc).";".scalar(@abc) }
574is prototype(\&t034), undef;
575is eval("t034()"), ";0";
576is eval("t034(0)"), "0;1";
577is eval("t034(456)"), "456;1";
578is eval("t034(456, 789)"), "456/789;2";
579is eval("t034(456, 789, 987)"), "456/789/987;3";
580is eval("t034(456, 789, 987, 654)"), "456/789/987/654;4";
581is eval("t034(456, 789, 987, 654, 321)"), "456/789/987/654/321;5";
582is eval("t034(456, 789, 987, 654, 321, 111)"), "456/789/987/654/321/111;6";
583is $a, 123;
584
863e3089
Z
585eval "#line 8 foo\nsub t136 (\@abc = 222) { }";
586like $@, qr/\AParse error at foo line 8\.\n/;
587
588eval "#line 8 foo\nsub t137 (\@abc =) { }";
589like $@, qr/\AParse error at foo line 8\.\n/;
590
30d9c59b
Z
591sub t035 (@) { $a }
592is prototype(\&t035), undef;
593is eval("t035()"), 123;
594is eval("t035(0)"), 123;
595is eval("t035(456)"), 123;
596is eval("t035(456, 789)"), 123;
597is eval("t035(456, 789, 987)"), 123;
598is eval("t035(456, 789, 987, 654)"), 123;
599is eval("t035(456, 789, 987, 654, 321)"), 123;
600is eval("t035(456, 789, 987, 654, 321, 111)"), 123;
601is $a, 123;
602
863e3089
Z
603eval "#line 8 foo\nsub t138 (\@ = 222) { }";
604like $@, qr/\AParse error at foo line 8\.\n/;
605
606eval "#line 8 foo\nsub t139 (\@ =) { }";
607like $@, qr/\AParse error at foo line 8\.\n/;
608
30d9c59b
Z
609sub t039 (%abc) { join("/", map { $_."=".$abc{$_} } sort keys %abc) }
610is prototype(\&t039), undef;
611is eval("t039()"), "";
612is eval("t039(0)"), undef;
aff539aa 613like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b 614is eval("t039(456)"), undef;
aff539aa 615like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
616is eval("t039(456, 789)"), "456=789";
617is eval("t039(456, 789, 987)"), undef;
aff539aa 618like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
619is eval("t039(456, 789, 987, 654)"), "456=789/987=654";
620is eval("t039(456, 789, 987, 654, 321)"), undef;
aff539aa 621like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
622is eval("t039(456, 789, 987, 654, 321, 111)"), "321=111/456=789/987=654";
623is $a, 123;
624
863e3089
Z
625eval "#line 8 foo\nsub t140 (\%abc = 222) { }";
626like $@, qr/\AParse error at foo line 8\.\n/;
627
628eval "#line 8 foo\nsub t141 (\%abc =) { }";
629like $@, qr/\AParse error at foo line 8\.\n/;
630
30d9c59b
Z
631sub t040 (%) { $a }
632is prototype(\&t040), undef;
633is eval("t040()"), 123;
634is eval("t040(0)"), undef;
aff539aa 635like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b 636is eval("t040(456)"), undef;
aff539aa 637like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
638is eval("t040(456, 789)"), 123;
639is eval("t040(456, 789, 987)"), undef;
aff539aa 640like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
641is eval("t040(456, 789, 987, 654)"), 123;
642is eval("t040(456, 789, 987, 654, 321)"), undef;
aff539aa 643like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
644is eval("t040(456, 789, 987, 654, 321, 111)"), 123;
645is $a, 123;
646
863e3089
Z
647eval "#line 8 foo\nsub t142 (\% = 222) { }";
648like $@, qr/\AParse error at foo line 8\.\n/;
649
650eval "#line 8 foo\nsub t143 (\% =) { }";
651like $@, qr/\AParse error at foo line 8\.\n/;
652
30d9c59b
Z
653sub t041 ($a, @b) { $a.";".join("/", @b) }
654is prototype(\&t041), undef;
655is eval("t041()"), undef;
aff539aa 656like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
657is eval("t041(0)"), "0;";
658is eval("t041(456)"), "456;";
659is eval("t041(456, 789)"), "456;789";
660is eval("t041(456, 789, 987)"), "456;789/987";
661is eval("t041(456, 789, 987, 654)"), "456;789/987/654";
662is eval("t041(456, 789, 987, 654, 321)"), "456;789/987/654/321";
663is eval("t041(456, 789, 987, 654, 321, 111)"), "456;789/987/654/321/111";
664is $a, 123;
665
666sub t042 ($a, @) { $a.";" }
667is prototype(\&t042), undef;
668is eval("t042()"), undef;
aff539aa 669like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
670is eval("t042(0)"), "0;";
671is eval("t042(456)"), "456;";
672is eval("t042(456, 789)"), "456;";
673is eval("t042(456, 789, 987)"), "456;";
674is eval("t042(456, 789, 987, 654)"), "456;";
675is eval("t042(456, 789, 987, 654, 321)"), "456;";
676is eval("t042(456, 789, 987, 654, 321, 111)"), "456;";
677is $a, 123;
678
679sub t043 ($, @b) { $a.";".join("/", @b) }
680is prototype(\&t043), undef;
681is eval("t043()"), undef;
aff539aa 682like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
683is eval("t043(0)"), "123;";
684is eval("t043(456)"), "123;";
685is eval("t043(456, 789)"), "123;789";
686is eval("t043(456, 789, 987)"), "123;789/987";
687is eval("t043(456, 789, 987, 654)"), "123;789/987/654";
688is eval("t043(456, 789, 987, 654, 321)"), "123;789/987/654/321";
689is eval("t043(456, 789, 987, 654, 321, 111)"), "123;789/987/654/321/111";
690is $a, 123;
691
692sub t044 ($, @) { $a.";" }
693is prototype(\&t044), undef;
694is eval("t044()"), undef;
aff539aa 695like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
696is eval("t044(0)"), "123;";
697is eval("t044(456)"), "123;";
698is eval("t044(456, 789)"), "123;";
699is eval("t044(456, 789, 987)"), "123;";
700is eval("t044(456, 789, 987, 654)"), "123;";
701is eval("t044(456, 789, 987, 654, 321)"), "123;";
702is eval("t044(456, 789, 987, 654, 321, 111)"), "123;";
703is $a, 123;
704
705sub t049 ($a, %b) { $a.";".join("/", map { $_."=".$b{$_} } sort keys %b) }
706is prototype(\&t049), undef;
707is eval("t049()"), undef;
aff539aa 708like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
709is eval("t049(222)"), "222;";
710is eval("t049(222, 456)"), undef;
aff539aa 711like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
712is eval("t049(222, 456, 789)"), "222;456=789";
713is eval("t049(222, 456, 789, 987)"), undef;
aff539aa 714like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
715is eval("t049(222, 456, 789, 987, 654)"), "222;456=789/987=654";
716is eval("t049(222, 456, 789, 987, 654, 321)"), undef;
aff539aa 717like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
718is eval("t049(222, 456, 789, 987, 654, 321, 111)"),
719 "222;321=111/456=789/987=654";
720is $a, 123;
721
722sub t051 ($a, $b, $c, @d) { "$a;$b;$c;".join("/", @d).";".scalar(@d) }
723is prototype(\&t051), undef;
724is eval("t051()"), undef;
aff539aa 725like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 726is eval("t051(456)"), undef;
aff539aa 727like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 728is eval("t051(456, 789)"), undef;
aff539aa 729like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
730is eval("t051(456, 789, 987)"), "456;789;987;;0";
731is eval("t051(456, 789, 987, 654)"), "456;789;987;654;1";
732is eval("t051(456, 789, 987, 654, 321)"), "456;789;987;654/321;2";
733is eval("t051(456, 789, 987, 654, 321, 111)"), "456;789;987;654/321/111;3";
734is $a, 123;
735
736sub t052 ($a, $b, %c) { "$a;$b;".join("/", map { $_."=".$c{$_} } sort keys %c) }
737is prototype(\&t052), undef;
738is eval("t052()"), undef;
aff539aa 739like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 740is eval("t052(222)"), undef;
aff539aa 741like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
742is eval("t052(222, 333)"), "222;333;";
743is eval("t052(222, 333, 456)"), undef;
aff539aa 744like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
745is eval("t052(222, 333, 456, 789)"), "222;333;456=789";
746is eval("t052(222, 333, 456, 789, 987)"), undef;
aff539aa 747like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
748is eval("t052(222, 333, 456, 789, 987, 654)"), "222;333;456=789/987=654";
749is eval("t052(222, 333, 456, 789, 987, 654, 321)"), undef;
aff539aa 750like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
751is eval("t052(222, 333, 456, 789, 987, 654, 321, 111)"),
752 "222;333;321=111/456=789/987=654";
753is $a, 123;
754
755sub t053 ($a, $b, $c, %d) {
756 "$a;$b;$c;".join("/", map { $_."=".$d{$_} } sort keys %d)
757}
758is prototype(\&t053), undef;
759is eval("t053()"), undef;
aff539aa 760like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 761is eval("t053(222)"), undef;
aff539aa 762like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 763is eval("t053(222, 333)"), undef;
aff539aa 764like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
765is eval("t053(222, 333, 444)"), "222;333;444;";
766is eval("t053(222, 333, 444, 456)"), undef;
aff539aa 767like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
768is eval("t053(222, 333, 444, 456, 789)"), "222;333;444;456=789";
769is eval("t053(222, 333, 444, 456, 789, 987)"), undef;
aff539aa 770like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
771is eval("t053(222, 333, 444, 456, 789, 987, 654)"),
772 "222;333;444;456=789/987=654";
773is eval("t053(222, 333, 444, 456, 789, 987, 654, 321)"), undef;
aff539aa 774like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
775is eval("t053(222, 333, 444, 456, 789, 987, 654, 321, 111)"),
776 "222;333;444;321=111/456=789/987=654";
777is $a, 123;
778
779sub t048 ($a = 222, @b) { $a.";".join("/", @b).";".scalar(@b) }
780is prototype(\&t048), undef;
781is eval("t048()"), "222;;0";
782is eval("t048(0)"), "0;;0";
783is eval("t048(456)"), "456;;0";
784is eval("t048(456, 789)"), "456;789;1";
785is eval("t048(456, 789, 987)"), "456;789/987;2";
786is eval("t048(456, 789, 987, 654)"), "456;789/987/654;3";
787is eval("t048(456, 789, 987, 654, 321)"), "456;789/987/654/321;4";
788is eval("t048(456, 789, 987, 654, 321, 111)"), "456;789/987/654/321/111;5";
789is $a, 123;
790
791sub t054 ($a = 222, $b = 333, @c) { "$a;$b;".join("/", @c).";".scalar(@c) }
792is prototype(\&t054), undef;
793is eval("t054()"), "222;333;;0";
794is eval("t054(456)"), "456;333;;0";
795is eval("t054(456, 789)"), "456;789;;0";
796is eval("t054(456, 789, 987)"), "456;789;987;1";
797is eval("t054(456, 789, 987, 654)"), "456;789;987/654;2";
798is eval("t054(456, 789, 987, 654, 321)"), "456;789;987/654/321;3";
799is eval("t054(456, 789, 987, 654, 321, 111)"), "456;789;987/654/321/111;4";
800is $a, 123;
801
802sub t055 ($a = 222, $b = 333, $c = 444, @d) {
803 "$a;$b;$c;".join("/", @d).";".scalar(@d)
804}
805is prototype(\&t055), undef;
806is eval("t055()"), "222;333;444;;0";
807is eval("t055(456)"), "456;333;444;;0";
808is eval("t055(456, 789)"), "456;789;444;;0";
809is eval("t055(456, 789, 987)"), "456;789;987;;0";
810is eval("t055(456, 789, 987, 654)"), "456;789;987;654;1";
811is eval("t055(456, 789, 987, 654, 321)"), "456;789;987;654/321;2";
812is eval("t055(456, 789, 987, 654, 321, 111)"), "456;789;987;654/321/111;3";
813is $a, 123;
814
815sub t050 ($a = 211, %b) { $a.";".join("/", map { $_."=".$b{$_} } sort keys %b) }
816is prototype(\&t050), undef;
817is eval("t050()"), "211;";
818is eval("t050(222)"), "222;";
819is eval("t050(222, 456)"), undef;
aff539aa 820like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
821is eval("t050(222, 456, 789)"), "222;456=789";
822is eval("t050(222, 456, 789, 987)"), undef;
aff539aa 823like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
824is eval("t050(222, 456, 789, 987, 654)"), "222;456=789/987=654";
825is eval("t050(222, 456, 789, 987, 654, 321)"), undef;
aff539aa 826like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
827is eval("t050(222, 456, 789, 987, 654, 321, 111)"),
828 "222;321=111/456=789/987=654";
829is $a, 123;
830
831sub t056 ($a = 211, $b = 311, %c) {
832 "$a;$b;".join("/", map { $_."=".$c{$_} } sort keys %c)
833}
834is prototype(\&t056), undef;
835is eval("t056()"), "211;311;";
836is eval("t056(222)"), "222;311;";
837is eval("t056(222, 333)"), "222;333;";
838is eval("t056(222, 333, 456)"), undef;
aff539aa 839like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
840is eval("t056(222, 333, 456, 789)"), "222;333;456=789";
841is eval("t056(222, 333, 456, 789, 987)"), undef;
aff539aa 842like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
843is eval("t056(222, 333, 456, 789, 987, 654)"), "222;333;456=789/987=654";
844is eval("t056(222, 333, 456, 789, 987, 654, 321)"), undef;
aff539aa 845like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
846is eval("t056(222, 333, 456, 789, 987, 654, 321, 111)"),
847 "222;333;321=111/456=789/987=654";
848is $a, 123;
849
850sub t057 ($a = 211, $b = 311, $c = 411, %d) {
851 "$a;$b;$c;".join("/", map { $_."=".$d{$_} } sort keys %d)
852}
853is prototype(\&t057), undef;
854is eval("t057()"), "211;311;411;";
855is eval("t057(222)"), "222;311;411;";
856is eval("t057(222, 333)"), "222;333;411;";
857is eval("t057(222, 333, 444)"), "222;333;444;";
858is eval("t057(222, 333, 444, 456)"), undef;
aff539aa 859like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
860is eval("t057(222, 333, 444, 456, 789)"), "222;333;444;456=789";
861is eval("t057(222, 333, 444, 456, 789, 987)"), undef;
aff539aa 862like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
863is eval("t057(222, 333, 444, 456, 789, 987, 654)"),
864 "222;333;444;456=789/987=654";
865is eval("t057(222, 333, 444, 456, 789, 987, 654, 321)"), undef;
aff539aa 866like $@, qr#\AOdd name/value argument for subroutine at \(eval \d+\) line 1\.\n\z#;
30d9c59b
Z
867is eval("t057(222, 333, 444, 456, 789, 987, 654, 321, 111)"),
868 "222;333;444;321=111/456=789/987=654";
869is $a, 123;
870
871sub t058 ($a, $b = 333, @c) { "$a;$b;".join("/", @c).";".scalar(@c) }
872is prototype(\&t058), undef;
873is eval("t058()"), undef;
aff539aa 874like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
875is eval("t058(456)"), "456;333;;0";
876is eval("t058(456, 789)"), "456;789;;0";
877is eval("t058(456, 789, 987)"), "456;789;987;1";
878is eval("t058(456, 789, 987, 654)"), "456;789;987/654;2";
879is eval("t058(456, 789, 987, 654, 321)"), "456;789;987/654/321;3";
880is eval("t058(456, 789, 987, 654, 321, 111)"), "456;789;987/654/321/111;4";
881is $a, 123;
882
883eval "#line 8 foo\nsub t059 (\@a, \$b) { }";
884is $@, "Slurpy parameter not last at foo line 8\.\n";
885
886eval "#line 8 foo\nsub t060 (\@a, \$b = 222) { }";
887is $@, "Slurpy parameter not last at foo line 8\.\n";
888
889eval "#line 8 foo\nsub t061 (\@a, \@b) { }";
890is $@, "Slurpy parameter not last at foo line 8\.\n";
891
892eval "#line 8 foo\nsub t062 (\@a, \%b) { }";
893is $@, "Slurpy parameter not last at foo line 8\.\n";
894
895eval "#line 8 foo\nsub t063 (\@, \$b) { }";
896is $@, "Slurpy parameter not last at foo line 8\.\n";
897
898eval "#line 8 foo\nsub t064 (\@, \$b = 222) { }";
899is $@, "Slurpy parameter not last at foo line 8\.\n";
900
901eval "#line 8 foo\nsub t065 (\@, \@b) { }";
902is $@, "Slurpy parameter not last at foo line 8\.\n";
903
904eval "#line 8 foo\nsub t066 (\@, \%b) { }";
905is $@, "Slurpy parameter not last at foo line 8\.\n";
906
907eval "#line 8 foo\nsub t067 (\@a, \$) { }";
908is $@, "Slurpy parameter not last at foo line 8\.\n";
909
910eval "#line 8 foo\nsub t068 (\@a, \$ = 222) { }";
911is $@, "Slurpy parameter not last at foo line 8\.\n";
912
913eval "#line 8 foo\nsub t069 (\@a, \@) { }";
914is $@, "Slurpy parameter not last at foo line 8\.\n";
915
916eval "#line 8 foo\nsub t070 (\@a, \%) { }";
917is $@, "Slurpy parameter not last at foo line 8\.\n";
918
919eval "#line 8 foo\nsub t071 (\@, \$) { }";
920is $@, "Slurpy parameter not last at foo line 8\.\n";
921
922eval "#line 8 foo\nsub t072 (\@, \$ = 222) { }";
923is $@, "Slurpy parameter not last at foo line 8\.\n";
924
925eval "#line 8 foo\nsub t073 (\@, \@) { }";
926is $@, "Slurpy parameter not last at foo line 8\.\n";
927
928eval "#line 8 foo\nsub t074 (\@, \%) { }";
929is $@, "Slurpy parameter not last at foo line 8\.\n";
930
931eval "#line 8 foo\nsub t075 (\%a, \$b) { }";
932is $@, "Slurpy parameter not last at foo line 8\.\n";
933
934eval "#line 8 foo\nsub t076 (\%, \$b) { }";
935is $@, "Slurpy parameter not last at foo line 8\.\n";
936
937eval "#line 8 foo\nsub t077 (\$a, \@b, \$c) { }";
938is $@, "Slurpy parameter not last at foo line 8\.\n";
939
940eval "#line 8 foo\nsub t078 (\$a, \%b, \$c) { }";
941is $@, "Slurpy parameter not last at foo line 8\.\n";
942
943eval "#line 8 foo\nsub t079 (\$a, \@b, \$c, \$d) { }";
944is $@, "Slurpy parameter not last at foo line 8\.\n";
945
946sub t080 ($a,,, $b) { $a.$b }
947is prototype(\&t080), undef;
948is eval("t080()"), undef;
aff539aa 949like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 950is eval("t080(456)"), undef;
aff539aa 951like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
952is eval("t080(456, 789)"), "456789";
953is eval("t080(456, 789, 987)"), undef;
aff539aa 954like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 955is eval("t080(456, 789, 987, 654)"), undef;
aff539aa 956like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
957is $a, 123;
958
959sub t081 ($a, $b,,) { $a.$b }
960is prototype(\&t081), undef;
961is eval("t081()"), undef;
aff539aa 962like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 963is eval("t081(456)"), undef;
aff539aa 964like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
965is eval("t081(456, 789)"), "456789";
966is eval("t081(456, 789, 987)"), undef;
aff539aa 967like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 968is eval("t081(456, 789, 987, 654)"), undef;
aff539aa 969like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
970is $a, 123;
971
972eval "#line 8 foo\nsub t082 (, \$a) { }";
973like $@, qr/\AParse error at foo line 8\.\n/;
974
975eval "#line 8 foo\nsub t083 (,) { }";
976like $@, qr/\AParse error at foo line 8\.\n/;
977
978sub t084($a,$b){ $a.$b }
979is prototype(\&t084), undef;
980is eval("t084()"), undef;
aff539aa 981like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 982is eval("t084(456)"), undef;
aff539aa 983like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
984is eval("t084(456, 789)"), "456789";
985is eval("t084(456, 789, 987)"), undef;
aff539aa 986like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 987is eval("t084(456, 789, 987, 654)"), undef;
aff539aa 988like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
989is $a, 123;
990
991sub t085
992 (
993 $
994 a
995 ,
996 ,
997 $
998 b
999 =
1000 333
1001 ,
1002 ,
1003 )
1004 { $a.$b }
1005is prototype(\&t085), undef;
1006is eval("t085()"), undef;
aff539aa 1007like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1008is eval("t085(456)"), "456333";
1009is eval("t085(456, 789)"), "456789";
1010is eval("t085(456, 789, 987)"), undef;
aff539aa 1011like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1012is eval("t085(456, 789, 987, 654)"), undef;
aff539aa 1013like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1014is $a, 123;
1015
1016sub t086
1017 ( #foo)))
1018 $ #foo)))
1019 a #foo)))
1020 , #foo)))
1021 , #foo)))
1022 $ #foo)))
1023 b #foo)))
1024 = #foo)))
1025 333 #foo)))
1026 , #foo)))
1027 , #foo)))
1028 ) #foo)))
1029 { $a.$b }
1030is prototype(\&t086), undef;
1031is eval("t086()"), undef;
aff539aa 1032like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1033is eval("t086(456)"), "456333";
1034is eval("t086(456, 789)"), "456789";
1035is eval("t086(456, 789, 987)"), undef;
aff539aa 1036like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1037is eval("t086(456, 789, 987, 654)"), undef;
aff539aa 1038like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1039is $a, 123;
1040
1041sub t087
1042 (#foo)))
1043 $ #foo)))
1044 a#foo)))
1045 ,#foo)))
1046 ,#foo)))
1047 $ #foo)))
1048 b#foo)))
1049 =#foo)))
1050 333#foo)))
1051 ,#foo)))
1052 ,#foo)))
1053 )#foo)))
1054 { $a.$b }
1055is prototype(\&t087), undef;
1056is eval("t087()"), undef;
aff539aa 1057like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1058is eval("t087(456)"), "456333";
1059is eval("t087(456, 789)"), "456789";
1060is eval("t087(456, 789, 987)"), undef;
aff539aa 1061like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1062is eval("t087(456, 789, 987, 654)"), undef;
aff539aa 1063like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1064is $a, 123;
1065
1066eval "#line 8 foo\nsub t088 (\$ #foo\na) { }";
1067is $@, "";
1068
1069eval "#line 8 foo\nsub t089 (\$#foo\na) { }";
1070like $@, qr/\AParse error at foo line 8\.\n/;
1071
1072eval "#line 8 foo\nsub t090 (\@ #foo\na) { }";
1073is $@, "";
1074
1075eval "#line 8 foo\nsub t091 (\@#foo\na) { }";
1076like $@, qr/\AParse error at foo line 8\.\n/;
1077
1078eval "#line 8 foo\nsub t092 (\% #foo\na) { }";
1079is $@, "";
1080
1081eval "#line 8 foo\nsub t093 (\%#foo\na) { }";
1082like $@, qr/\AParse error at foo line 8\.\n/;
1083
1084eval "#line 8 foo\nsub t094 (123) { }";
1085like $@, qr/\AParse error at foo line 8\.\n/;
1086
1087eval "#line 8 foo\nsub t095 (\$a, 123) { }";
1088like $@, qr/\AParse error at foo line 8\.\n/;
1089
1090eval "#line 8 foo\nsub t096 (\$a 123) { }";
1091like $@, qr/\AParse error at foo line 8\.\n/;
1092
1093eval "#line 8 foo\nsub t097 (\$a { }) { }";
1094like $@, qr/\AParse error at foo line 8\.\n/;
1095
1096eval "#line 8 foo\nsub t098 (\$a; \$b) { }";
1097like $@, qr/\AParse error at foo line 8\.\n/;
1098
1099eval "#line 8 foo\nsub t099 (\$\$) { }";
1100like $@, qr/\AParse error at foo line 8\.\n/;
1101
1102no warnings "experimental::lexical_topic";
1103sub t100 ($_) { "$::_/$_" }
1104is prototype(\&t100), undef;
1105$_ = "___";
1106is eval("t100()"), undef;
aff539aa 1107like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1108$_ = "___";
1109is eval("t100(0)"), "___/0";
1110$_ = "___";
1111is eval("t100(456)"), "___/456";
1112$_ = "___";
1113is eval("t100(456, 789)"), undef;
aff539aa 1114like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1115$_ = "___";
1116is eval("t100(456, 789, 987)"), undef;
aff539aa 1117like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1118is $a, 123;
1119
1120eval "#line 8 foo\nsub t101 (\@_) { }";
1121like $@, qr/\ACan't use global \@_ in "my" at foo line 8/;
1122
1123eval "#line 8 foo\nsub t102 (\%_) { }";
1124like $@, qr/\ACan't use global \%_ in "my" at foo line 8/;
1125
1126my $t103 = sub ($a) { $a || "z" };
1127is prototype($t103), undef;
1128is eval("\$t103->()"), undef;
aff539aa 1129like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1130is eval("\$t103->(0)"), "z";
1131is eval("\$t103->(456)"), 456;
1132is eval("\$t103->(456, 789)"), undef;
aff539aa 1133like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1134is eval("\$t103->(456, 789, 987)"), undef;
aff539aa 1135like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1136is $a, 123;
1137
1138my $t118 = sub :prototype($) ($a) { $a || "z" };
1139is prototype($t118), "\$";
1140is eval("\$t118->()"), undef;
aff539aa 1141like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1142is eval("\$t118->(0)"), "z";
1143is eval("\$t118->(456)"), 456;
1144is eval("\$t118->(456, 789)"), undef;
aff539aa 1145like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1146is eval("\$t118->(456, 789, 987)"), undef;
aff539aa 1147like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1148is $a, 123;
1149
1150sub t033 ($a = sub ($a) { $a."z" }) { $a->("a")."y" }
1151is prototype(\&t033), undef;
1152is eval("t033()"), "azy";
1153is eval("t033(sub { \"x\".\$_[0].\"x\" })"), "xaxy";
1154is eval("t033(sub { \"x\".\$_[0].\"x\" }, 789)"), undef;
aff539aa 1155like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1156is $a, 123;
1157
863e3089
Z
1158sub t133 ($a = sub ($a = 222) { $a."z" }) { $a->()."/".$a->("a") }
1159is prototype(\&t133), undef;
1160is eval("t133()"), "222z/az";
1161is eval("t133(sub { \"x\".(\$_[0] // \"u\").\"x\" })"), "xux/xax";
1162is eval("t133(sub { \"x\".(\$_[0] // \"u\").\"x\" }, 789)"), undef;
aff539aa 1163like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
863e3089
Z
1164is $a, 123;
1165
1166sub t134 ($a = sub ($a, $t = sub { $_[0]."p" }) { $t->($a)."z" }) {
1167 $a->("a")."/".$a->("b", sub { $_[0]."q" } )
1168}
1169is prototype(\&t134), undef;
1170is eval("t134()"), "apz/bqz";
1171is eval("t134(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1172 "xax/xbqx";
1173is eval("t134(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1174 undef;
aff539aa 1175like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
863e3089
Z
1176is $a, 123;
1177
1178sub t135 ($a = sub ($a, $t = sub ($p) { $p."p" }) { $t->($a)."z" }) {
1179 $a->("a")."/".$a->("b", sub { $_[0]."q" } )
1180}
1181is prototype(\&t135), undef;
1182is eval("t135()"), "apz/bqz";
1183is eval("t135(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1184 "xax/xbqx";
1185is eval("t135(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1186 undef;
aff539aa 1187like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
863e3089
Z
1188is $a, 123;
1189
1190sub t132 (
1191 $a = sub ($a, $t = sub ($p = 222) { $p."p" }) { $t->($a)."z".$t->() },
1192) {
1193 $a->("a")."/".$a->("b", sub { ($_[0] // "u")."q" } )
1194}
1195is prototype(\&t132), undef;
1196is eval("t132()"), "apz222p/bqzuq";
1197is eval("t132(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" })"),
1198 "xax/xbqx";
1199is eval("t132(sub { \"x\".(\$_[1] // sub{\$_[0]})->(\$_[0]).\"x\" }, 789)"),
1200 undef;
aff539aa 1201like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
863e3089
Z
1202is $a, 123;
1203
30d9c59b
Z
1204sub t104 :method ($a) { $a || "z" }
1205is prototype(\&t104), undef;
1206is eval("t104()"), undef;
aff539aa 1207like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1208is eval("t104(0)"), "z";
1209is eval("t104(456)"), 456;
1210is eval("t104(456, 789)"), undef;
aff539aa 1211like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1212is eval("t104(456, 789, 987)"), undef;
aff539aa 1213like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1214is $a, 123;
1215
1216sub t105 :prototype($) ($a) { $a || "z" }
1217is prototype(\&t105), "\$";
1218is eval("t105()"), undef;
1219like $@, qr/\ANot enough arguments for main::t105 /;
1220is eval("t105(0)"), "z";
1221is eval("t105(456)"), 456;
1222is eval("t105(456, 789)"), undef;
aff539aa 1223like $@, qr/\AToo many arguments for main::t105 at \(eval \d+\) line 1, near/;
30d9c59b 1224is eval("t105(456, 789, 987)"), undef;
aff539aa 1225like $@, qr/\AToo many arguments for main::t105 at \(eval \d+\) line 1, near/;
30d9c59b
Z
1226is $a, 123;
1227
1228sub t106 :prototype(@) ($a) { $a || "z" }
1229is prototype(\&t106), "\@";
1230is eval("t106()"), undef;
aff539aa 1231like $@, qr/\AToo few arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1232is eval("t106(0)"), "z";
1233is eval("t106(456)"), 456;
1234is eval("t106(456, 789)"), undef;
aff539aa 1235like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b 1236is eval("t106(456, 789, 987)"), undef;
aff539aa 1237like $@, qr/\AToo many arguments for subroutine at \(eval \d+\) line 1\.\n\z/;
30d9c59b
Z
1238is $a, 123;
1239
1240eval "#line 8 foo\nsub t107 (\$a) :method { }";
1241isnt $@, "";
1242
1243eval "#line 8 foo\nsub t108 (\$a) :prototype(\$) { }";
1244isnt $@, "";
1245
1246sub t109 { }
1247is prototype(\&t109), undef;
1248is scalar(@{[ t109() ]}), 0;
1249is scalar(t109()), undef;
1250
1251sub t110 () { }
1252is prototype(\&t110), undef;
1253is scalar(@{[ t110() ]}), 0;
1254is scalar(t110()), undef;
1255
1256sub t111 ($a) { }
1257is prototype(\&t111), undef;
1258is scalar(@{[ t111(222) ]}), 0;
1259is scalar(t111(222)), undef;
1260
1261sub t112 ($) { }
1262is prototype(\&t112), undef;
1263is scalar(@{[ t112(222) ]}), 0;
1264is scalar(t112(222)), undef;
1265
1266sub t114 ($a = undef) { }
1267is prototype(\&t114), undef;
1268is scalar(@{[ t114() ]}), 0;
1269is scalar(t114()), undef;
1270is scalar(@{[ t114(333) ]}), 0;
1271is scalar(t114(333)), undef;
1272
1273sub t113 ($a = 222) { }
1274is prototype(\&t113), undef;
1275is scalar(@{[ t113() ]}), 0;
1276is scalar(t113()), undef;
1277is scalar(@{[ t113(333) ]}), 0;
1278is scalar(t113(333)), undef;
1279
1280sub t115 ($a = do { $z++; 222 }) { }
1281is prototype(\&t115), undef;
1282$z = 0;
1283is scalar(@{[ t115() ]}), 0;
1284is $z, 1;
1285is scalar(t115()), undef;
1286is $z, 2;
1287is scalar(@{[ t115(333) ]}), 0;
1288is scalar(t115(333)), undef;
1289is $z, 2;
1290
1291sub t116 (@a) { }
1292is prototype(\&t116), undef;
1293is scalar(@{[ t116() ]}), 0;
1294is scalar(t116()), undef;
1295is scalar(@{[ t116(333) ]}), 0;
1296is scalar(t116(333)), undef;
1297
1298sub t117 (%a) { }
1299is prototype(\&t117), undef;
1300is scalar(@{[ t117() ]}), 0;
1301is scalar(t117()), undef;
1302is scalar(@{[ t117(333, 444) ]}), 0;
1303is scalar(t117(333, 444)), undef;
1304
1ccc3f31
FC
1305use File::Spec::Functions;
1306my $keywords_file = catfile(updir,'regen','keywords.pl');
1307open my $kh, $keywords_file
1308 or die "$0 cannot open $keywords_file: $!";
1309while(<$kh>) {
1310 if (m?__END__?..${\0} and /^[+-]/) {
1311 chomp(my $word = $');
1312 # $y should be an error after $x=foo. The exact error we get may
1313 # differ if this is __END__ or s or some other special keyword.
1314 eval 'sub ($x = ' . $word . ', $y) {}';
1315 local $::TODO = 'does not work yet'
1316 if $word =~ /^(?:chmod|chown|die|exec|glob|kill|mkdir|print
1317 |printf|return|reverse|select|setpgrp|sort|split
1318 |system|unlink|utime|warn)\z/x;
1319 isnt $@, "", "$word does not swallow trailing comma";
1320 }
1321}
1322
1323done_testing;
1324
30d9c59b 13251;