Skip to content

Commit 51989fe

Browse files
committed
Merge pull request #60 from pmurias/master
Added a test
2 parents 21af32a + 0e83ea3 commit 51989fe

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

t/nqp/65-how.t

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!./parrot nqp.pbc
2+
3+
# check subs
4+
5+
plan(4);
6+
7+
class Foo {
8+
has $!foo_attr;
9+
}
10+
class Bar is Foo {
11+
has $!bar_attr;
12+
}
13+
14+
my $foo := Foo.new();
15+
my @Foo-attrs := $foo.HOW.attributes($foo,:local(1));
16+
ok(@Foo-attrs[0].name eq '$!foo_attr',"we can get an attribute");
17+
my $bar := Bar.new();
18+
ok(+$bar.HOW.attributes($bar,:local(1)) == 1,"we only get local attributes");
19+
ok(+$bar.HOW.attributes($bar,:local(0)) == 2,"we get all attributes");
20+
ok($bar.HOW.attributes($bar) == 2,"we can skip :local");

0 commit comments

Comments
 (0)