Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dotnet] fix bug jnthn++ found; add tests for the non-"is rw" case
  • Loading branch information
diakopter committed Nov 17, 2010
1 parent 64f1a9c commit 72c91f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/NQP/NQPSetting.pm
Expand Up @@ -749,7 +749,7 @@ my knowhow NQPAttribute {
!! nqp::get_attr(self, $obj.WHAT, $long_name);
});
} else {
$obj.HOW.add_method($obj, nqp::substr($short_name, 2), method () {
$obj.HOW.add_method($obj, $short_name, method () {
nqp::get_attr(self, $obj.WHAT, $long_name);
});
}
Expand Down
17 changes: 16 additions & 1 deletion t/nqp/56-accessors.t
@@ -1,7 +1,7 @@
# auto-generatored accessors & mutators
# but not lvalue as in Perl 6, just "fluent" mutator methods

plan(2);
plan(4);

class Foo3 { has $.bar is rw }

Expand All @@ -13,3 +13,18 @@ my $foo := Foo3.new();
ok($foo.bar("baz") eq "baz");

ok($foo.bar eq "baz");

class Foo4 {
has $.foo;

method set_foo($val) {
$.foo := $val
}
}

my $foo4 := Foo4.new();

ok($foo4.set_foo(99) == 99);

ok($foo4.foo == 99);

0 comments on commit 72c91f0

Please sign in to comment.