diff options
Diffstat (limited to 't/fun/basic.t')
-rw-r--r-- | t/fun/basic.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/fun/basic.t b/t/fun/basic.t new file mode 100644 index 0000000..53a8476 --- /dev/null +++ b/t/fun/basic.t @@ -0,0 +1,34 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/fun/lib'; + +use Fun; + +fun mul ($x, $y) { + return $x * $y; +} + +is(mul(3, 4), 12); + +fun sum (@nums) { + my $sum; + for my $num (@nums) { + $sum += $num; + } + return $sum; +} + +is(sum(1, 2, 3, 4), 10); + +{ + package Foo; + use Fun; + fun foo { } + foo(); +} + +ok(exists $Foo::{foo}); + +done_testing; |