Permalink
Browse files

[t/spec] merge attribute_of_return_value.t into instance.t

git-svn-id: http://svn.pugscode.org/pugs@25920 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 466c0bf commit 8cdbdfd359d80f6cfa53379b347381a6f09ad34a moritz committed Mar 19, 2009
Showing with 17 additions and 1 deletion.
  1. +17 −1 S12-attributes/instance.t
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 93;
+plan 97;
=begin pod
@@ -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.