Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add samewith tests for RT #125539
  • Loading branch information
lizmat committed Jul 5, 2015
1 parent cf2e631 commit b7acec1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion S06-multi/redispatch.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 10;
plan 13;

# it doesn't seem to be explicit in S06, but {next,call}{same,with}
# work with multi subs too, not just with methods
Expand Down Expand Up @@ -54,3 +54,20 @@ plan 10;
try { nextsame };
isa-ok $!, X::NoDispatcher, 'nextsame in main block dies due to lack of dispatcher';
}

# RT 125539
{
multi a(Int $a) { samewith "$a" }
multi a(Str $a) { is $a, "42", 'samewith $a stringified in sub' }

class B {
multi method b(Int $b) { samewith "$b" }
multi method b(Str $b) {
is $b, "42", 'samewith $b stringified for ' ~ self.perl;
}
}

a 42;
B.b(42);
B.new.b(42);
}

0 comments on commit b7acec1

Please sign in to comment.