Skip to content

Commit 4a314bf

Browse files
committed
fix 58-attrs.t
1 parent 95fbb94 commit 4a314bf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/nqp/58-attrs.t

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
plan(2);
44

55
class Foo {
6-
has $bar;
7-
86
has $!answer;
9-
method question() { $!answer := 42 };
7+
method question($what) { $!answer := $what }
8+
method answer() { $!answer }
109
};
1110

12-
my $foo := Foo.new;
11+
my $first := Foo.new;
12+
my $second := Foo.new;
1313

14-
$foo.question();
15-
ok($foo.answer == 42, "Read-only accessors works");
14+
$first.question(42);
15+
$second.question(23);
16+
ok($first.answer == 42, "attributes work");
17+
ok($second.answer == 23, "... and are not shared among objects");
1618

17-
$foo.bar(42);
18-
ok($foo.bar == 42, 'Read-write accessors works');

0 commit comments

Comments
 (0)