-#!/usr/bin/perl
-
use strict;
use warnings;
use Test::Requires {
'Digest' => 0.01, # skip all if not installed
- 'Digest::SHA1' => 0.01,
+ 'Digest::SHA' => 0.00,
'JSON::Any' => 0.01,
};
object => Foo->new( number => 2 ),
);
isa_ok( $foo, 'Foo' );
-
+
my $packed = $foo->pack;
-
+
cmp_deeply(
$packed,
{
float => 10.5,
array => [ 1 .. 10 ],
hash => { map { $_ => undef } ( 1 .. 10 ) },
- object => {
- __CLASS__ => 'Foo',
- __DIGEST__ => re('[0-9a-f]+'),
- number => 2
- },
+ object => {
+ __CLASS__ => 'Foo',
+ __DIGEST__ => re('[0-9a-f]+'),
+ number => 2
+ },
},
'... got the right frozen class'
);
$foo2 = Foo->unpack($packed);
}, undef, '... unpacked okay');
isa_ok($foo2, 'Foo');
-
+
cmp_deeply(
$foo2->pack,
{
float => 10.5,
array => [ 1 .. 10 ],
hash => { map { $_ => undef } ( 1 .. 10 ) },
- object => {
- __CLASS__ => 'Foo',
- __DIGEST__ => re('[0-9a-f]+'),
- number => 2
- },
+ object => {
+ __CLASS__ => 'Foo',
+ __DIGEST__ => re('[0-9a-f]+'),
+ number => 2
+ },
},
'... got the right frozen class'
- );
+ );
}
{
SKIP: {
eval { require Digest::HMAC_SHA1 };
- skip join( " ", "no Digest::HMAC", ( $@ =~ /\@INC/ ? () : do { chomp(my $e = $@); "($e)" } ) ), 15 if $@;
+ if ($@)
+ {
+ my $message = join( " ", "no Digest::HMAC", ( $@ =~ /\@INC/ ? () : do { chomp(my $e = $@); "($e)" } ) );
+ die $message if $ENV{AUTHOR_TESTING};
+ skip $message, 15;
+ }
local $::DEBUG = 1;