X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F17-calls.t;h=5d58d2aa2e00d80cb4b14356cedf46be864bc98e;hb=HEAD;hp=8db7ac4518657741ea4d951a68577ec9fa183a1e;hpb=3f86aade0125d81087495585dc71c827858428be;p=perl%2Fmodules%2FB-RecDeparse.git diff --git a/t/17-calls.t b/t/17-calls.t index 8db7ac4..5d58d2a 100644 --- a/t/17-calls.t +++ b/t/17-calls.t @@ -3,14 +3,16 @@ use strict; use warnings; -use Test::More tests => 2 * 4 * 5; +use Test::More; use B::RecDeparse; my $brd = B::RecDeparse->new(level => -1); sub foo { 123 } +sub baz; my $pkg; +my $coderef; my @tests = ( [ e1 => 'foo()', '123' ], @@ -18,10 +20,20 @@ my @tests = ( [ e3 => 'foo(@_)', '123' ], [ e4 => 'foo(shift)', '123' ], - [ x1 => 'bar()', 'bar' ], - [ x2 => 'bar(1)', 'bar' ], - [ x3 => 'bar(@_)', 'bar' ], - [ x4 => 'bar(shift)', 'bar' ], + [ n1 => 'bar()', 'bar' ], + [ n2 => 'bar(1)', 'bar' ], + [ n3 => 'bar(@_)', 'bar' ], + [ n4 => 'bar(shift)', 'bar' ], + + [ d1 => 'baz()', 'baz' ], + [ d2 => 'baz(1)', 'baz' ], + [ d3 => 'baz(@_)', 'baz' ], + [ d4 => 'baz(shift)', 'baz' ], + + [ c1 => '$coderef->()', 'coderef' ], + [ c2 => '$coderef->(1)', 'coderef' ], + [ c3 => '$coderef->(@_)', 'coderef' ], + [ c4 => '$coderef->(shift)', 'coderef' ], [ m1 => '"pkg"->qux()', 'qux' ], [ m2 => '"pkg"->qux(1)', 'qux' ], @@ -37,6 +49,17 @@ my @tests = ( [ m12 => 'shift->qux(shift)', 'qux' ], ); +if (eval 'use List::Util qw; 1') { + push @tests, ( + [ x1 => 'sum()', 'sum' ], + [ x2 => 'sum(1)', 'sum' ], + [ x3 => 'sum(@_)', 'sum' ], + [ x4 => 'sum(shift)', 'sum' ], + ); +} + +plan tests => 2 * @tests; + for my $test (@tests) { my ($name, $source, $match) = @$test;