Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix Proxy tests to not use indirect method syntax, and use methods as…
… callbacks, as per current S06
  • Loading branch information
moritz committed Dec 21, 2011
1 parent b3cf6e6 commit 7748996
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions S06-routine-modifiers/proxy.t
Expand Up @@ -23,9 +23,9 @@ my $was_inside = 0;

sub lvalue_test1() is rw {
$was_inside++;
return new Proxy:
FETCH => { 100 + $foo },
STORE => { $foo = $^new - 100 };
return Proxy.new:
FETCH => method () { 100 + $foo },
STORE => method ($new) { $foo = $new - 100 };
};

{
Expand All @@ -49,24 +49,21 @@ $was_inside = 0;

sub lvalue_test2() is rw {
$was_inside++;
return new Proxy:
FETCH => { 10 + $foo },
STORE => { $foo = $^new - 100 };
return Proxy.new:
FETCH => method () { 10 + $foo },
STORE => method ($new) { $foo = $new - 100 };
};

{
is $foo, 4, "basic sanity (3)";
is $was_inside, 0, "basic sanity (4)";

skip_rest 'XXX - lvalue vars not available - incoherent test results';
exit;

is lvalue_test2(), 14, "getting var through Proxy (4)";
# No todo_is here to avoid unexpected succeeds
is $was_inside, 1, "lvalue_test2() was called (4)";

is (lvalue_test2() = 106), 166, "setting var through Proxy returns new
value of the var";
is (lvalue_test2() = 106), 16, "setting var through Proxy returns new value of the var";
is $was_inside, 2, "lvalue_test2() was called (5)";
is $foo, 6, "var was correctly set (2)";

Expand Down

0 comments on commit 7748996

Please sign in to comment.