X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F32-atom-and.t;h=4fff4bbb43e66c254263e2c09a059f11b36cca2c;hb=767226606d8814fe22df55137330473be0b5c0cf;hp=36819abd84576d62fd5c5b357c5a73a33a4cb682;hpb=9e50d0a5cd63e13e194009d6fbdedb75e75eaa5e;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/t/32-atom-and.t b/t/32-atom-and.t index 36819ab..4fff4bb 100644 --- a/t/32-atom-and.t +++ b/t/32-atom-and.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 2 * (2 + (8 * 7) / 2 + 2); +use Test::More tests => 2 * (2 + (8 * 7) / 2 + 2) + 3 * 4; use CPANPLUS::Dist::Gentoo::Atom; @@ -119,7 +119,45 @@ for my $t (@tests) { } elsif ($err) { fail "$desc failed but shouldn't: $err"; } else { - cmp_ok $a, '==', $exp, "$desc == '$exp'"; + ok +($a == $exp), "$desc == '$exp'"; } } } + +my $a1b = A->new( + category => 'test', + name => 'a', + version => '1.0', +); + +my $b1 = A->new( + category => 'test', + name => 'b', + version => '1.0', + range => '<', +); + +my $b2 = A->new( + category => 'test', + name => 'b', + version => '3.0', + range => '<', +); + +my @folded = eval { A->fold($a1b, $a5, $b1, $b2) }; +is $@, '', 'aabb: no error'; +is @folded, 2, 'aabb: fold results in two atoms'; +ok $folded[0] == $a5, 'aabb: first result is >=test/a-2.0'; +ok $folded[1] == $b1, 'aabb: second result is fold($a1b, $b1, $b2, $a5) }; +is $@, '', 'abba: no error'; +is @folded, 2, 'abba: fold results in two atoms'; +ok $folded[0] == $a5, 'abba: first result is >=test/a-2.0'; +ok $folded[1] == $b1, 'abba: second result is fold($a1b, $b1, $a5, $b2) }; +is $@, '', 'abab: no error'; +is @folded, 2, 'abab: fold results in two atoms'; +ok $folded[0] == $a5, 'abab: first result is >=test/a-2.0'; +ok $folded[1] == $b1, 'abab: second result is