Debian Codegraph @

t/tests.t

raw symbols SCIP
1 #!/usr/bin/perl
2
3 use warnings 'all';
4 use strict;
5 BEGIN {
6 if (-d "lib") {
7 use lib "./lib";
8 } elsif (-d "../lib") {
9 use lib "../lib";
10 }
11 }
12
13 use Test::Inter;
14 my $ti = new Test::Inter $0;
15
16 sub func {
17 my(@args) = @_;
18 my @ret;
19 foreach my $arg (@args) {
20 push(@ret,length($arg));
21 }
22 return @ret;
23 }
24
25 $ti->tests(func => \&func,
26 tests => "foo => 3
27
28 a ab => 1 2
29
30 (x xy xyz) => 1 2 3
31
32 (a) (bc) => 1 2
33
34 (a (b cd)) => 1 1 2
35
36 (,a,bc) => 1 2
37
38 (,a,b c) => 1 3
39 ");
40
41 $ti->tests(func => \&func,
42 expected => [ [1,2] ],
43 tests => "a ab
44
45 c cd
46
47 e ef
48 ");
49
50 $ti->tests(func => \&func,
51 expected => "1 2",
52 tests => "a ab
53
54 c cd
55
56 e ef
57 ");
58
59 $ti->tests(tests => " '' ''
60
61 [] []
62
63 {} {}
64 ");
65
66 $ti->done_testing();