6 use blib 't/Sub-Op-Test';
8 use Test::More tests => 2 * 15 + 21;
15 my ($code, $params) = split /----\s*/, $_;
16 my ($name, $ret, $exp) = split /\s*#\s*/, $params;
20 fail "unable to get expected values: $@";
27 use Sub::Op::Test $name => sub {
29 my \$exp = shift \@exp;
30 is_deeply \\\@_, \$exp, '$name: arguments are correct';
37 no warnings 'uninitialized'; # Test::Builder can't get the file name
38 is *main::${name}{CODE}, undef, '$name: no symbol table vivification';
46 fail "$name: unable to evaluate test case: $@";
50 is $called, $calls, "$name: the hook was called the right number of times";
51 if ($called < $calls) {
52 fail for $called + 1 .. $calls;
81 wut # () # [ ], [ 1 ], [ 2, 3 ]
85 qux # @_ # [ 1 ], [ 1 ]
87 wat 1, wat, 2, wat(3, 4), 5
89 wat # @_ # [ ], [ 3, 4 ], [ 1, 2, 3, 4, 5 ]
91 sum sum sum(1, 2), sum(3, 4)
93 sum # do { my $s = 0; $s += $_ for @_; $s } # [ 1, 2 ], [ 3, 4 ], [ 3, 7 ], [ 10 ]
105 fetch 1, do { no strict 'refs'; *{__PACKAGE__.'::fetch'}{CODE} }, 2
107 fetch # () # [ 1, undef, 2 ]
117 array # () # [ 2, 3 ]
119 our %hash = (x => 4);