Skip to content

Commit

Permalink
[S12-attributes/instance,S06-signature/code] Unfudge for niecza
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jan 16, 2012
1 parent 9ebc638 commit 6755bea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions S06-signature/code.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ tester(sub ($x) { $collector = 3 * $x });
ok $collector == 12, 'same with anonymous sub';

sub tester2(&my_sub) { 1 } #OK not used
#?niecza todo
dies_ok {eval 'tester2(42)' }, "can't pass thing that doesn't do Callable";

sub not_returns_a_sub { 3 };
#?niecza todo
dies_ok { eval 'tester2(not_returns_a_sub)' },
"can't pass thing that doesn't do Callable";

Expand Down
15 changes: 5 additions & 10 deletions S12-attributes/instance.t
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class Foo1 { has $.bar; };

# L<S12/Semantics of C<bless>/If you name an attribute as a parameter, that attribute is initialized directly, so>

#?niecza skip "Unhandled parameter twigil !"
{
class Foo6 {
has $.bar is rw;
Expand All @@ -145,15 +144,14 @@ class Foo1 { has $.bar; };

# check that doing something in submethod BUILD works

#?niecza skip "Unhandled parameter twigil !"
{
class Foo6a {
has $.bar is rw;
has $.baz is rw;
has $!hidden;

submethod BUILD (:$!hidden, :$!bar = 10, :$!baz?) {
$.baz = 5;
$!baz = 5;
}
method get_hidden() { $!hidden }
}
Expand All @@ -167,7 +165,6 @@ class Foo1 { has $.bar; };
}

# check that assignment in submethod BUILD works with a bare return, too
#?niecza skip "Unhandled parameter twigil !"
{
class Foo6b {
has $.bar is rw;
Expand Down Expand Up @@ -201,7 +198,6 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
}

# check that doing something in submethod BUILD works
#?niecza skip "Unhandled parameter twigil !"
{
class Foo7 {
has $.bar is rw;
Expand Down Expand Up @@ -246,15 +242,14 @@ is Foo7e.new.attr, 42, "default attribute value (1)";

# check mixture of positional/named args to BUILD

#?niecza skip 'Virtual call $.a may not be used on partially constructed object'
{
class Foo9 {
has $.a;
has $.b;

submethod BUILD($foo, :$bar) {
$.a = $foo;
$.b = $bar;
$!a = $foo;
$!b = $bar;
}
}

Expand Down Expand Up @@ -544,8 +539,8 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
has $.s is rw;
has B $.b is rw;
submethod BUILD {
$.b = B.new;
$.s = $.b.t(1, 2, 3);
$!b = B.new;
$!s = $!b.t(1, 2, 3);
}
}

Expand Down

0 comments on commit 6755bea

Please sign in to comment.