Revision 29950
- Date:
- 2010/03/06 01:18:04
- Files:
Legend:
- Added
- Removed
- Modified
-
t/spec/S14-roles/basic.t
54 54 my Bar $b .= new(); 55 55 $b does B; 56 56 ok defined($b), 'mixing B into $b worked'; 57 #?rakudo 2 skip "Method 'defined' not found for invocant of class 'Undef'" 57 58 is $b.attr, 42, '$b "inherited" the $.attr attribute of B (1)'; 58 59 is ($b.attr = 23), 23, '$b "inherited" the $.attr attribute of B (2)'; 59 60 … … 63 64 ok defined($c), 'creating a Foo worked'; 64 65 ok !($c ~~ B), '$c does not B'; 65 66 ok (my $d = $c but B), 'mixing in a Role via but worked'; 67 #?rakudo todo 'Saying $c but B seems to change $c' 66 68 ok !($c ~~ B), '$c still does not B...'; 67 69 ok $d ~~ B, '...but $d does B'; 68 70 } … … 71 73 role C { } 72 74 class DoesC does C { } 73 75 lives_ok { my C $x; }, 'can use role as a type constraint on a variable'; 76 #?rakudo todo 'Cannot assign Mu to variable with role constraint -- bug or feature?' 74 77 lives_ok { my C $x = Mu }, 'can assign undefined'; 75 78 dies_ok { my C $x = 42 }, 'type-check enforced'; 76 79 dies_ok { my C $x; $x = 42 }, 'type-check enforced in future assignments too'; … … 84 87 lives_ok { HasC.new.x = DoesC.new }, 85 88 'typed attribute accepts things it should'; 86 89 lives_ok { HasC.new.x = Mu }, 'typed attribute accepts things it should'; 90 #?rakudo todo "Type attribute accepts anything?" 87 91 dies_ok { HasC.new.x = 42 }, 'typed attribute rejects things it should'; 88 92 89 93 # Checking if role does role