Skip to content

Commit

Permalink
[t/spec] Add a test for RT#75822 and correct another test so we can u…
Browse files Browse the repository at this point in the history
…n-todo it.

git-svn-id: http://svn.pugscode.org/pugs@31380 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
jnthn committed Jun 19, 2010
1 parent f2938f2 commit 31f28a8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions S14-roles/instantiation.t
Expand Up @@ -8,7 +8,7 @@ use Test;
# classes. Hence, RoleName.new() instantiates an object that will probably fail
# on all stubs.

plan 18;
plan 19;

role SampleRole {
method sample_method () { 42 }
Expand All @@ -25,8 +25,7 @@ role SampleRole {
my $obj2 = SampleRole.new;
ok $obj.WHAT === $obj2.WHAT, "Punned role classes have the same .WHAT";

#?rakudo todo 'protoobject regression'
is ~$obj.WHAT, 'SampleRole', '.WHAT as a string gives the name of the role';
is ~$obj.WHAT, 'SampleRole()', '.WHAT as a string gives the name of the role';
}

role WithAttr {
Expand Down Expand Up @@ -57,6 +56,12 @@ role ParaRole[$x] {
is $obj2.get_x, 100, "instantiated object has method with correct associated role parameter";
}

role ParaRole2Args[$x, $y] {
method x { $x + $y }
}

is ParaRole2Args[4, 5].new.x, 9, 'instantiating a parametric role with two arguments works';

# Can also pun a role and inherit from the punned class.
{
class TestA is SampleRole { }
Expand Down

0 comments on commit 31f28a8

Please sign in to comment.