Skip to content

Commit

Permalink
Tests for whatever currying
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 27, 2010
1 parent ac8238d commit 9d1fa25
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test.pl
Expand Up @@ -2,7 +2,7 @@

use Test;

plan 117;
plan 126;

ok 1, "one is true";
ok 2, "two is also true";
Expand Down Expand Up @@ -365,3 +365,18 @@
}
ok $*quux == 111, "but only in the one scope";
}

{
my $whatever = *;
ok $whatever.WHAT eq 'Whatever()', "can call methods on a specific Whatever";
my $wwhat = *.WHAT;
ok !($wwhat.^isa(Whatever)), "method calls against * curry, though";

ok (* + 5)(2) == 7, "can curry simple binops";
ok ((*) eq "foo") eq "Bool::False", "parens defeat Whatever directly";
ok (1 + 2 * *)(5) == 11, "nested Whatever works";
ok (2 * (1 + *))(5) == 12, "parens for grouping do not kill WhateverCode";
ok (* + *)(5,12) == 19, "multiple *, multiple args";
ok ((2 * *) + (3 * *))(13,19) == 83, "even from groups";
ok (1,*).^isa(Parcel), "infix:<,> doesn't curry";
}

0 comments on commit 9d1fa25

Please sign in to comment.