]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - t/31-atom-cmp.t
Fix $atom1 cmp $atom2
[perl/modules/CPANPLUS-Dist-Gentoo.git] / t / 31-atom-cmp.t
index 580101012b763481acef6c3af74bd2358c0da027..9422071f4e8481832a156a133f8e47a713962ff3 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2 * 5 * ((8 * 7) / 2);
+use Test::More tests => 2 * 8 * ((8 * 7) / 2);
 
 use CPANPLUS::Dist::Gentoo::Atom;
 
@@ -128,7 +128,8 @@ for my $t (@tests) {
   my $bs = "$b";
   compare_ok($a, '<=>', $bs, $exp);
 
-  if (my $bv = $b->version) {
+  my $bv = $b->version;
+  if (defined $bv) {
    compare_ok($a, '<=>', $bv,   $exp);
    compare_ok($a, '<=>', "$bv", $exp);
   } else {
@@ -136,5 +137,14 @@ for my $t (@tests) {
   }
 
   compare_ok($a, 'cmp', $b, $exp);
+
+  my $bz = $b->qualified_name;
+  $bz   .= "-$bv" if defined $bv;
+  compare_ok($a, 'cmp', $bz, $exp);
+
+  $bz  = "test/zzz";
+  $bz .= "-$bv" if defined $bv;
+  compare_ok($a,  'cmp', $bz, -1);
+  compare_ok($bz, 'cmp', $b,  1);
  }
 }