From: Vincent Pit Date: Sat, 16 Aug 2008 10:23:40 +0000 (+0200) Subject: Add tests for ||, && and // X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Nary.git;a=commitdiff_plain;h=8830bd5a774a9d459a6c843b7dbc177c13f753fc Add tests for ||, && and // --- diff --git a/t/23-branch.t b/t/23-branch.t index 2f97ea8..e2638f7 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 + ($^V ge v5.10.0 ? 1 : 0); use Sub::Nary; @@ -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 ($^V ge v5.10.0)), ); my $i = 1;