Upgrade to Test::Simple 0.60
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / 00signature.t
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More;
5
6 if (!eval { require Module::Signature; 1 }) {
7     plan skip_all => 
8       "Next time around, consider installing Module::Signature, ".
9       "so you can verify the integrity of this distribution.";
10 }
11 elsif ( !-e 'SIGNATURE' ) {
12     plan skip_all => "SIGNATURE not found";
13 }
14 elsif ( -s 'SIGNATURE' == 0 ) {
15     plan skip_all => "SIGNATURE file empty";
16 }
17 elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
18     plan skip_all => "Cannot connect to the keyserver to check module ".
19                      "signature";
20 }
21 else {
22     plan tests => 1;
23 }
24
25 my $ret = Module::Signature::verify();
26 SKIP: {
27     skip "Module::Signature cannot verify", 1 
28       if $ret eq Module::Signature::CANNOT_VERIFY()   or
29          $ret eq Module::Signature::CIPHER_UNKNOWN();
30
31     cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature";
32 }
33