Permalink
Browse files

Add a test for NQPClassHOW.

  • Loading branch information...
pmurias committed Oct 18, 2012
1 parent 21af32a commit 0e83ea3c08027b3e9b3677a85c524f46c1ac9698
Showing with 20 additions and 0 deletions.
  1. +20 −0 t/nqp/65-how.t
View
@@ -0,0 +1,20 @@
#!./parrot nqp.pbc
# check subs
plan(4);
class Foo {
has $!foo_attr;
}
class Bar is Foo {
has $!bar_attr;
}
my $foo := Foo.new();
my @Foo-attrs := $foo.HOW.attributes($foo,:local(1));
ok(@Foo-attrs[0].name eq '$!foo_attr',"we can get an attribute");
my $bar := Bar.new();
ok(+$bar.HOW.attributes($bar,:local(1)) == 1,"we only get local attributes");
ok(+$bar.HOW.attributes($bar,:local(0)) == 2,"we get all attributes");
ok($bar.HOW.attributes($bar) == 2,"we can skip :local");

0 comments on commit 0e83ea3

Please sign in to comment.