]> git.vpit.fr Git - perl/modules/Acme-CPANAuthors-You-re_using.git/blobdiff - t/10-base.t
In t/10-base.t, reprint extra warnings as diagnostics
[perl/modules/Acme-CPANAuthors-You-re_using.git] / t / 10-base.t
index 60a54bc8eb1326f29483fe6cb642dd7a037bbc63..72e2bd88caaa110805050ce7a000c20fb3bd10d0 100644 (file)
@@ -3,16 +3,37 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More;
 
 use Acme::CPANAuthors;
 
-my $authors = eval { Acme::CPANAuthors->new("You're_using") };
+local @INC = grep $_ ne '.', @INC;
 
-SKIP: {
- skip $@ => 1 unless defined $authors;
+diag 'Directories in @INC :';
+diag "  $_" for @INC;
 
- my $count = $authors->count;
- diag "$count authors found";
- cmp_ok $count, '>', 0, 'there are some authors';
+my $authors = eval {
+ local $SIG{__WARN__} = sub {
+  my ($msg) = @_;
+  if ($msg =~ /^You're_using CPAN Authors are not registered yet: (.*)/s) {
+   die $1;
+  }
+  diag $_ for @_;
+ };
+ Acme::CPANAuthors->new("You're_using");
+};
+
+if ($authors) {
+ plan tests => 5;
+} else {
+ plan skip_all => $@;
 }
+
+my $count = $authors->count;
+diag "$count authors found";
+cmp_ok $count, '>', 0, 'there are some authors';
+
+is   $authors->name('???'),      undef,         'wrong name';
+is   $authors->name('VPIT'),     'Vincent Pit', 'we should at least have this module';
+isnt $authors->name('ISHIGAKI'), undef,         'we should at least have Acme::CPANAuthors\' author';
+isnt $authors->name('GAAS'),     undef,         'we should at least have LWP\'s author';