X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F22-call.t;h=6aa786333a1bebd54980c6a27c63267796510e74;hb=3271ef4bff5871bc6aa2d90537f97f177cbacc2a;hp=f7bb741cf8027a5b18a2fcdda76e070d1e195e59;hpb=4b846088d0ffe4f979b145ec2af821922bd5c7af;p=perl%2Fmodules%2FSub-Nary.git diff --git a/t/22-call.t b/t/22-call.t index f7bb741..6aa7863 100644 --- a/t/22-call.t +++ b/t/22-call.t @@ -3,12 +3,16 @@ use strict; use warnings; -use Test::More tests => 39; +use Test::More tests => 42; use Sub::Nary; my $sn = Sub::Nary->new(); +sub CORE::GLOBAL::reset { + return 1, 2, 3 +} + sub zero { } sub one { 1 } sub two { 1, 2 } @@ -20,6 +24,8 @@ sub rec1 { rec2(); } sub rec2 { rec1(); } my @tests = ( + [ sub { hlaghlaghlagh() }, 'list' ], + [ sub { zero }, 0 ], [ sub { one }, 1 ], [ sub { two }, 2 ], @@ -68,11 +74,15 @@ my @tests = ( [ sub { \&zero }, 1 ], [ sub { *zero }, 1 ], [ sub { *zero{CODE}->() }, 'list' ], + + [ sub { &CORE::GLOBAL::shift }, 'list' ], + [ sub { &CORE::GLOBAL::reset }, 3 ], ); my $i = 1; for (@tests) { my $r = $sn->nary($_->[0]); - is_deeply($r, { $_->[1] => 1 }, 'call test ' . $i); + my $exp = ref $_->[1] ? $_->[1] : { $_->[1] => 1 }; + is_deeply($r, $exp, 'call test ' . $i); ++$i; }