summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-08-30 00:47:28 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-09-07 21:32:44 +0000
commitedbe35ea95baf286c38bf4d7db7d18b82ecce254 (patch)
treeadb91b86b01e307776b416f8d88b0fe5c0de22d9 /ext
parent5625ef69b645a2ef31d454433f1d69f8d40af74f (diff)
downloadperl-edbe35ea95baf286c38bf4d7db7d18b82ecce254.tar.gz
Re: unless(...) terser than if(!...)
Message-ID: <48B86060.4090905@profvince.com> p4raw-id: //depot/perl@34310
Diffstat (limited to 'ext')
-rw-r--r--ext/B/t/deparse.t28
1 files changed, 27 insertions, 1 deletions
diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t
index a8cb3560d0..f28c68821a 100644
--- a/ext/B/t/deparse.t
+++ b/ext/B/t/deparse.t
@@ -27,7 +27,7 @@ BEGIN {
require feature;
feature->import(':5.10');
}
-use Test::More tests => 64;
+use Test::More tests => 66;
use B::Deparse;
my $deparse = B::Deparse->new();
@@ -432,3 +432,29 @@ use constant H => { "#" => 1 }; H->{"#"}
# SKIP ?$B::Deparse::VERSION <= 0.87 && "TODO optimized away 0 not yet fixed"
# 57 (cpan-bug #33708)
foreach my $i (@_) { 0 }
+####
+# 58 tests with not, not optimized
+x() unless $a;
+x() if not $a and $b;
+x() if $a and not $b;
+x() unless not $a and $b;
+x() unless $a and not $b;
+x() if not $a or $b;
+x() if $a or not $b;
+x() unless not $a or $b;
+x() unless $a or not $b;
+####
+# 59 tests with not, optimized
+x() if not $a;
+x() unless not $a;
+x() if not $a and not $b;
+x() unless not $a and not $b;
+x() if not $a or not $b;
+x() unless not $a or not $b;
+>>>>
+x() unless $a;
+x() if $a;
+x() unless $a or $b;
+x() if $a or $b;
+x() unless $a and $b;
+x() unless not $a && $b;