Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests for RT #124121.
  • Loading branch information
jnthn committed Jul 18, 2015
1 parent 0853325 commit 0cee736
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion S14-roles/mixin.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 37;
plan 45;

# L<S14/Run-time Mixins/>

Expand Down Expand Up @@ -187,4 +187,24 @@ lives-ok {(True but role {}).gist}, 'can mix into True';
ok ([] but B) ~~ B, 'Mix-in to item array works';
}

# RT #124121
{
my $x;
lives-ok { $x = True but [1, 2] }, 'but with array literal on RHS works';
is $x.Array, [1, 2], 'but with array literal provides a .Array method';
}
{
my $x;
lives-ok { $x = True but (1, 2).list }, 'but with (1, 2).list on RHS works';
is $x.List, (1, 2).list, 'but with (1, 2).list provides a .List method';
}
{
my $x;
lives-ok { $x = True but (1, "x") }, 'but with (1, "2") on RHS works';
is $x.Int, 1, 'but with (1, "x") provides a .Int method returning 1';
is $x.Str, "x", 'but with (1, "x") provides a .Str method returning "x"';
}
throws-like 'True but (1, 1)', Exception, gist => { $^g ~~ /'Int'/ && $g ~~ /resolved/ },
'True but (1, 1) gets Int conflict to resolve due to generating two Int methods';

# vim: syn=perl6

0 comments on commit 0cee736

Please sign in to comment.