summaryrefslogtreecommitdiffstats
path: root/t/fun/basic.t
blob: 06a724fab23ba7b9c41e3a03db2fe68e5a8eddb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use lib 't/fun/lib';

use Test::Requires 'Sub::Name';

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;