summaryrefslogtreecommitdiffstats
path: root/t/basic.t
blob: 2b2104f1d2717d610b6cc39d0ca8fad5d67ce2f8 (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
37
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

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 { }
}

ok(exists $Foo::{foo});

fun empty ($bar, $baz) { }

is(scalar(empty(1, 2)), undef);
is_deeply([empty(1, 2)], []);

done_testing;