Skip to content

Commit

Permalink
[t/spec] merge attribute_of_return_value.t into instance.t
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@25920 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Mar 19, 2009
1 parent 466c0bf commit 8cdbdfd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion S12-attributes/instance.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 93;
plan 97;

=begin pod
Expand Down Expand Up @@ -414,4 +414,20 @@ is eval('Foo9.new.attr'), 42, "default attribute value (3)";
ok(TA2.new.foo, '=== works on typed attribute initialized with proto-object');
}

# used to be pugs regression
{
class C_Test { has $.a; }
sub f() { C_Test.new(:a(123)) }
sub g() { my C_Test $x .= new(:a(123)); $x }

is(C_Test.new(:a(123)).a, 123, 'C_Test.new().a worked');

my $o = f();
is($o.a, 123, 'my $o = f(); $o.a worked');

is((try { f().a }), 123, 'f().a worked (so the pugsbug is fixed (part 1))');

is((try { g().a }), 123, 'g().a worked (so the pugsbug is fixed (part 2))');
}

# vim: ft=perl6

0 comments on commit 8cdbdfd

Please sign in to comment.