do not skip any tests in author mode - die instead!
[gitmo/MooseX-Storage.git] / t / 030_with_checksum.t
index f123821..e38986a 100644 (file)
@@ -1,15 +1,13 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Test::Deep;
 
 use Test::Requires {
     'Digest' => 0.01, # skip all if not installed
-    'Digest::SHA1' => 0.01,
+    'Digest::SHA' => 0.00,
     'JSON::Any' => 0.01,
 };
 
@@ -43,9 +41,9 @@ BEGIN {
         object => Foo->new( number => 2 ),
     );
     isa_ok( $foo, 'Foo' );
-    
+
     my $packed = $foo->pack;
-    
+
     cmp_deeply(
         $packed,
         {
@@ -56,21 +54,21 @@ BEGIN {
             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'
     );
 
     my $foo2;
-    lives_ok {
+    is( exception {
         $foo2 = Foo->unpack($packed);
-    } '... unpacked okay';
+    }, undef, '... unpacked okay');
     isa_ok($foo2, 'Foo');
-    
+
     cmp_deeply(
         $foo2->pack,
         {
@@ -81,14 +79,14 @@ BEGIN {
             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'
-    );    
+    );
 }
 
 {
@@ -118,7 +116,12 @@ BEGIN {
 
 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;