[libmoosex-has-sugar-perl] 13/29: Skip various tests if Moose or MooseX::Types::Moose is missing

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 27 21:35:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 1.000000-source
in repository libmoosex-has-sugar-perl.

commit ae31f38fe6f715984ee7d4fee181e95344bc729c
Author: Kent Fredric <kentfredric at gmail.com>
Date:   Fri Jan 31 06:51:22 2014 +1300

    Skip various tests if Moose or MooseX::Types::Moose is missing
---
 t/05_is.t              | 18 ++++++++++++++++++
 t/06_attr_required.t   | 18 ++++++++++++++++++
 t/07_attr_lazy_build.t | 18 ++++++++++++++++++
 t/08_saccharin.t       | 18 ++++++++++++++++++
 t/10_saccharin.t       | 25 +++++++++++++------------
 5 files changed, 85 insertions(+), 12 deletions(-)

diff --git a/t/05_is.t b/t/05_is.t
index 0451d55..3dab84c 100644
--- a/t/05_is.t
+++ b/t/05_is.t
@@ -3,6 +3,24 @@ use strict;
 use warnings;
 
 use Test::More;
+
+BEGIN {
+  my $mod = 'Moose';
+  eval 'require $mod; 1';
+  if ( my $e = $@ ) {
+    my $msg = "$e";
+    if ( $e =~ /^Can't locate/ ) {
+      $msg = "Test requires module '$mod' but it's not found";
+    }
+    if ( $ENV{RELEASE_TESTING} ) {
+      BAIL_OUT($msg);
+    }
+    else {
+      plan skip_all => $msg;
+    }
+  }
+}
+
 use Test::Fatal;
 
 use lib "t/lib";
diff --git a/t/06_attr_required.t b/t/06_attr_required.t
index 2534acb..afcc27b 100644
--- a/t/06_attr_required.t
+++ b/t/06_attr_required.t
@@ -3,6 +3,24 @@ use strict;
 use warnings;
 
 use Test::More;
+
+BEGIN {
+  my $mod = 'Moose';
+  eval 'require $mod; 1';
+  if ( my $e = $@ ) {
+    my $msg = "$e";
+    if ( $e =~ /^Can't locate/ ) {
+      $msg = "Test requires module '$mod' but it's not found";
+    }
+    if ( $ENV{RELEASE_TESTING} ) {
+      BAIL_OUT($msg);
+    }
+    else {
+      plan skip_all => $msg;
+    }
+  }
+}
+
 use Test::Fatal;
 use lib "t/lib";
 
diff --git a/t/07_attr_lazy_build.t b/t/07_attr_lazy_build.t
index a9fdffa..f53378d 100644
--- a/t/07_attr_lazy_build.t
+++ b/t/07_attr_lazy_build.t
@@ -3,6 +3,24 @@ use strict;
 use warnings;
 
 use Test::More;
+
+BEGIN {
+  my $mod = 'Moose';
+  eval 'require $mod; 1';
+  if ( my $e = $@ ) {
+    my $msg = "$e";
+    if ( $e =~ /^Can't locate/ ) {
+      $msg = "Test requires module '$mod' but it's not found";
+    }
+    if ( $ENV{RELEASE_TESTING} ) {
+      BAIL_OUT($msg);
+    }
+    else {
+      plan skip_all => $msg;
+    }
+  }
+}
+
 use Test::Fatal;
 
 use lib "t/lib";
diff --git a/t/08_saccharin.t b/t/08_saccharin.t
index 962993c..ff200b5 100644
--- a/t/08_saccharin.t
+++ b/t/08_saccharin.t
@@ -3,6 +3,24 @@ use strict;
 use warnings;
 
 use Test::More;
+
+BEGIN {
+  my $mod = 'Moose';
+  eval 'require $mod; 1';
+  if ( my $e = $@ ) {
+    my $msg = "$e";
+    if ( $e =~ /^Can't locate/ ) {
+      $msg = "Test requires module '$mod' but it's not found";
+    }
+    if ( $ENV{RELEASE_TESTING} ) {
+      BAIL_OUT($msg);
+    }
+    else {
+      plan skip_all => $msg;
+    }
+  }
+}
+
 use Test::Fatal;
 use lib "t/lib";
 
diff --git a/t/10_saccharin.t b/t/10_saccharin.t
index b61d4e2..1fb34f3 100644
--- a/t/10_saccharin.t
+++ b/t/10_saccharin.t
@@ -5,18 +5,19 @@ use warnings;
 use Test::More;
 
 BEGIN {
-  my $mod = 'MooseX::Types::Moose';
-  eval 'require $mod; 1';
-  if ( my $e = $@ ) {
-    my $msg = "$e";
-    if ( $e =~ /^Can't locate/ ) {
-      $msg = "Test requires module '$mod' but it's not found";
-    }
-    if ( $ENV{RELEASE_TESTING} ) {
-      BAIL_OUT($msg);
-    }
-    else {
-      plan skip_all => $msg;
+  for my $mod (qw( Moose MooseX::Types::Moose )) {
+    eval 'require $mod; 1';
+    if ( my $e = $@ ) {
+      my $msg = "$e";
+      if ( $e =~ /^Can't locate/ ) {
+        $msg = "Test requires module '$mod' but it's not found";
+      }
+      if ( $ENV{RELEASE_TESTING} ) {
+        BAIL_OUT($msg);
+      }
+      else {
+        plan skip_all => $msg;
+      }
     }
   }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoosex-has-sugar-perl.git



More information about the Pkg-perl-cvs-commits mailing list