Subject: | Test::More must be loaded after threads have been loaded |
Because it loads threads::shared, Test::More must be loaded after
threads have been enabled. This patch rectifies that.
Subject: | 0001-Load-Test-More-after-threads-have-been-loaded.patch |
From e541f1fc5ba6b0c64cf7d97806773126c8d9bd0e Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Wed, 25 Apr 2012 18:50:56 -0700
Subject: [PATCH] Load Test::More *after* threads have been loaded.
Also bump the required version of Test::More so it has done_testing().
---
Makefile.PL | 1 +
t/Queue-Any.t | 17 +++++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 9d2b32c..8c1b182 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -36,5 +36,6 @@ WriteMakefile (
PREREQ_PM => {
'Thread::Queue' => 0,
'Storable' => 0,
+ 'Test::More' => 0.88, # for done_testing()
},
);
diff --git a/t/Queue-Any.t b/t/Queue-Any.t
index 3ff59ac..8e44e04 100644
--- a/t/Queue-Any.t
+++ b/t/Queue-Any.t
@@ -7,13 +7,19 @@ BEGIN { # Magic Perl CORE pragma
use strict;
use warnings;
-use Test::More tests => 16;
+my %Loaded;
BEGIN {
- eval "use threads; 1" or eval "use forks; 1";
- diag $@ if !ok( !$@, "threads or forks loaded ok" );
+ $Loaded{threads} = eval "use threads; 1";
+ $Loaded{forks} = eval "use forks; 1" unless $Loaded{threads};
}
-BEGIN { use_ok('Thread::Queue::Any') }
+use Thread::Queue::Any;
+
+use Test::More;
+
+diag "threads loaded" if $Loaded{threads};
+diag "forks loaded" if $Loaded{forks};
+ok $Loaded{threads} || $Loaded{forks}, "thread-like module loaded";
my $q = Thread::Queue::Any->new;
isa_ok( $q, 'Thread::Queue::Any', 'check object type' );
@@ -59,3 +65,6 @@ ok(
my @e = $q->dequeue_dontwait;
cmp_ok( @e, '==', 0, 'check # elements non blocking' );
+
+done_testing(15);
+
--
1.7.9.4