Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[inheritance.t] tests for RT #74844
  • Loading branch information
moritz committed Jan 31, 2011
1 parent b814b4d commit bfe67a6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion S12-class/inheritance.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 39;
plan 42;

# L<S12/Classes/An "isa" is just a trait that happens to be another class>

Expand Down Expand Up @@ -141,4 +141,22 @@ eval_lives_ok 'class NotAny is Mu { }; NotAny.new', 'inheritance from Mu works';

eval_dies_ok 'class RT64642 is ::Nowhere {}', 'dies: class D is ::C {}';

# check that inheriting from Array works
{
class ArrayChild is Array {
method summary() { self.join(', ') }
}

my $a = ArrayChild.new;
$a.push('foo');
$a.push('bar');
is $a.join('|'), 'foo|bar', 'inheritance from Array';
is $a.summary, 'foo, bar', 'and ArrayChild methods work';

my @a := ArrayChild.new;
@a.push: 3, 5;
is @a.summary, '3, 5', 'new methods still work in @ variables';

}

# vim: ft=perl6

0 comments on commit bfe67a6

Please sign in to comment.