Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (27 sloc) 0.729 kB
use v6;
use Test;
plan 3;
=begin description
=head1 Initialization of parent attributes
These are some tests for "Construction and Initialization" section of Synopsis
12, based on example code from Jonathan Worthington's Rakudo tests for
parent attribute initialization
=end description
# L<S12/Construction and Initialization/>
class Foo {
has $.x is rw;
method boo { $.x }
}
class Bar is Foo {
method set($v) { $.x = $v }
}
my Foo $u .= new(x => 5);
is($u.boo, 5, 'set attribute');
#?rakudo skip 'initialization of parent attributes RT #125129'
{
$u= Bar.new(Foo{ x => 12 });
is($u.boo, 12, 'set parent attribute');
$u.set(9);
is($u.boo, 9, 'reset parent attribute');
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.