2 # Copyright (C) 2001-2008, The Perl Foundation.
7 t/pmc/multisub.t - Multi Sub PMCs
11 % prove t/pmc/multisub.t
15 Tests the creation and invocation of Perl6 multi subs.
21 .include 'include/test_more.pir'
30 is($I0, 0, "multisubs start empty")
33 is($S0, "testing no arg", "no argument variant")
35 is($S0, "testing hello", "single string variant")
37 is($S0, "testing 5", "single int variant")
38 $S0 = foo(42, "goodbye")
39 is($S0, "testing 42, goodbye", "int and string variant")
41 ## Test handling of :flat parameters.
42 $P0 = new 'ResizablePMCArray'
46 is($S0, "testing 42, goodbye", "Int and String :flat")
47 ## Now try double :flat (regression test for RT#43869).
48 $P1 = new 'ResizablePMCArray'
50 $P2 = new 'ResizablePMCArray'
52 $S0 = foo($P1 :flat, $P2 :flat)
53 is($S0, "testing 42, goodbye", "Int and String double :flat")
58 .return ('testing no arg')
61 .sub foo :multi(string)
63 $S0 = "testing " . bar
70 $S0 = "testing " . $S1
74 .sub foo :multi(int, string)
78 $S0 = "testing " . $S1
84 .sub foo :multi(Integer, String)
89 $S0 = "testing " . $S1
99 # vim: expandtab shiftwidth=4 ft=pir: