From: Vincent Pit Date: Sun, 29 Nov 2009 01:15:02 +0000 (+0100) Subject: C::D::G::Atom->and ought to handle only one atom X-Git-Tag: v0.09~8 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=5bb7f214348c0e45363adc5cf51d479a240a7c49 C::D::G::Atom->and ought to handle only one atom --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index e285b0c..5cd01e3 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -215,6 +215,8 @@ sub and { shift unless length ref $_[0]; my $a1 = shift; + return $a1 unless @_; + my $a2 = shift; $a2 = $a2->and(@_) if @_; diff --git a/t/31-atom-and.t b/t/31-atom-and.t index 6de1b3a..9dcf18c 100644 --- a/t/31-atom-and.t +++ b/t/31-atom-and.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 2 * ((8 * 7) / 2 + 2); +use Test::More tests => 2 * (2 + (8 * 7) / 2 + 2); use CPANPLUS::Dist::Gentoo::Atom; @@ -60,6 +60,9 @@ my $x_ver = qr/Version mismatch/; my $x_range = qr/Incompatible ranges/; my @tests = ( + [ [ $a0 ] => $a0 ], + [ [ $a1 ] => $a1 ], + [ [ $a0, $a0 ] => $a0 ], [ [ $a0, $a1 ] => $a1 ], [ [ $a0, $a2 ] => $a2 ],