Skip to content

Commit

Permalink
[attributes.t] test .get_value and .set_value
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Sep 29, 2010
1 parent 48f7ecf commit 0e3783c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion S12-introspection/attributes.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 26;
plan 30;

=begin pod
Expand Down Expand Up @@ -60,4 +60,14 @@ ok @attrs[1] ~~ Array, 'second element is array';
is @attrs[1][0].name, '$!b', 'can look into second element array to find next attribute';
is @attrs[1][1][0].name, '$!a', 'can look deeper to find attribute beyond that';

{
my $x = A.new(a => 'abc');
my $attr = $x.^attributes(:local).[0];
isa_ok $attr, Attribute;
is $attr.get_value($x), 'abc', '.get_value works';
lives_ok { $attr.set_value($x, 'new') }, 'can set_value';
is $x.a, 'new', 'set_value worked';

}

# vim: ft=perl6

0 comments on commit 0e3783c

Please sign in to comment.