Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (26 sloc) 0.828 kB
use v6;
use MONKEY_TYPING;
use Test;
# L<S11/Compile-time Importation>
plan 7;
# test that 'use' imports class names defined in importet packages
use t::spec::packages::UseTest;
eval_lives_ok 'Stupid::Class.new()', 'can instantiate object of "imported" class';
{
my $o = Stupid::Class.new(attrib => 'a');
is $o.attrib, 'a', 'can access attribute';
is $o.getter, 'a', 'can access method';
$o.setter('b');
is $o.attrib, 'b', 'can set through setter';
lives_ok { $o.attrib = 'c' }, 'can set trough assignment';
is $o.attrib, 'c', 'setting actually worked';
}
#?rakudo skip 'augment'
{
augment class Stupid::Class {
method double { $.attrib ~ $.attrib };
}
my $o = Stupid::Class.new( attrib => 'd' );
is $o.double, 'dd', 'can extend "imported" class';
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.