whitespace
[p5sagit/Try-Tiny.git] / t / context.t
index e2f25b8..bc428c9 100644 (file)
@@ -2,18 +2,14 @@ use strict;
 use warnings;
 
 use Test::More;
+use Try::Tiny;
 
-BEGIN {
-  plan tests =>
-    1         # use_ok
-  + (4+1) * 2 # list/scalar with exception (try + catch + 2 x finally) + is_deeply
-  + 4         # void with exception
-  + (3+1) * 2 # list/scalar no exception (try + 2 x finally) + is_deeply
-  + 3         # void no exception
-  ;
-
-  use_ok 'Try::Tiny';
-}
+plan tests =>
+  (4+1) * 2 # list/scalar with exception (try + catch + 2 x finally) + is_deeply
++ 4         # void with exception
++ (3+1) * 2 # list/scalar no exception (try + 2 x finally) + is_deeply
++ 3         # void no exception
+;
 
 my $ctx_index = {
   VOID => undef,
@@ -56,11 +52,19 @@ sub run {
     return 'catch';
   }
   finally {
-    is (wantarray, undef, "Proper VOID context in finally{} 1");
+    SKIP: {
+      skip "DESTROY() not called in void context on perl $]", 1
+        if "$]" < '5.008';
+      is (wantarray, undef, "Proper VOID context in finally{} 1");
+    }
     return 'finally';
   }
   finally {
-    is (wantarray, undef, "Proper VOID context in finally{} 2");
+    SKIP: {
+      skip "DESTROY() not called in void context on perl $]", 1
+        if "$]" < '5.008';
+      is (wantarray, undef, "Proper VOID context in finally{} 2");
+    }
     return 'finally';
   };
 }