diff options
Diffstat (limited to 't/fun/anon.t')
-rw-r--r-- | t/fun/anon.t | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/fun/anon.t b/t/fun/anon.t new file mode 100644 index 0000000..88b6991 --- /dev/null +++ b/t/fun/anon.t @@ -0,0 +1,17 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/fun/lib'; + +use Fun; + +my $fun = fun ($x, $y) { $x * $y }; + +is($fun->(3, 4), 12); + +my $fun2 = fun ($z, $w = 10) { $z / $w }; + +is($fun2->(60), 6); + +done_testing; |