]> git.vpit.fr Git - perl/modules/Sub-Nary.git/commitdiff
Add tests for ||, && and //
authorVincent Pit <vince@profvince.com>
Sat, 16 Aug 2008 10:23:40 +0000 (12:23 +0200)
committerVincent Pit <vince@profvince.com>
Sat, 16 Aug 2008 10:23:40 +0000 (12:23 +0200)
t/23-branch.t

index 2f97ea8d604eed9f7591975ba6e9cf62d9ef40e3..e2638f76bc246b62d23623bc4177b6a54819ced9 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-use Test::More tests => 17;
+use Test::More tests => 21 + ($^V ge v5.10.0 ? 1 : 0);
 
 use Sub::Nary;
 
 
 use Sub::Nary;
 
@@ -81,6 +81,12 @@ my @tests = (
 
  [ \&retinif1, { 2 => 1 } ],
  [ \&retinif2, { 2 => 0.5, 3 => 0.25, 1 => 0.25 } ],
 
  [ \&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;
 );
 
 my $i = 1;