X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Nary.git;a=blobdiff_plain;f=t%2F23-branch.t;h=fef709dc1da61c42bddf566e42d0ca974b4c924e;hp=2f97ea8d604eed9f7591975ba6e9cf62d9ef40e3;hb=HEAD;hpb=3ad0dc082fd7c56afdc76066a7f8c94c4ae28e69 diff --git a/t/23-branch.t b/t/23-branch.t index 2f97ea8..fef709d 100644 --- a/t/23-branch.t +++ b/t/23-branch.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 21 + ("$]" >= 5.010 ? 1 : 0); use Sub::Nary; @@ -40,7 +40,7 @@ sub ret1234 { } elsif ($h{foo}) { return 3, @a[4, 5]; } elsif (@a) { - return @h{qw/a b c/}, $y + return @h{qw}, $y } } @@ -81,6 +81,12 @@ my @tests = ( [ \&retinif1, { 2 => 1 } ], [ \&retinif2, { 2 => 0.5, 3 => 0.25, 1 => 0.25 } ], + + [ sub { $x || (3, 4) }, { 1 => 0.5, 2 => 0.5 } ], + [ sub { $x or (3, 4) }, { 1 => 0.5, 2 => 0.5 } ], + [ sub { $x && (3, 4) }, { 1 => 0.5, 2 => 0.5 } ], + [ sub { $x and (3, 4) }, { 1 => 0.5, 2 => 0.5 } ], + (([ eval 'sub { $x // (3, 4) }', { 1 => 0.5, 2 => 0.5 } ]) x ("$]" >= 5.010)), ); my $i = 1;