version 1.0401
[p5sagit/Function-Parameters.git] / t / regress.t
CommitLineData
c311cef3 1#!perl
2
3use Test::More tests => 21;
4
5use warnings FATAL => 'all';
6use strict;
7
8use Function::Parameters;
9
10fun mk_counter($i) {
11 fun () { $i++ }
12}
13
14method nop() {}
15fun fnop($x, $y, $z) {
16}
17
18is_deeply [nop], [];
19is_deeply [main->nop], [];
20is_deeply [nop 1], [];
21is scalar(nop), undef;
22is scalar(nop 2), undef;
23
24is_deeply [fnop], [];
25is_deeply [fnop 3, 4], [];
26is scalar(fnop), undef;
27is scalar(fnop 5, 6), undef;
28
29my $f = mk_counter 0;
30my $g = mk_counter 10;
31my $h = mk_counter 50;
32
33is $f->(), 0;
34is $g->(), 10;
35is $h->(), 50;
36is $f->(), 1;
37is $g->(), 11;
38is $h->(), 51;
39is $f->(), 2;
40is $f->(), 3;
41is $f->(), 4;
42is $g->(), 12;
43is $h->(), 52;
44is $g->(), 13;