]> git.vpit.fr Git - perl/modules/VPIT-TestHelpers.git/blobdiff - t/44-threads-too-late.t
Be more precise when Test::Leaner/Test::More were loaded early
[perl/modules/VPIT-TestHelpers.git] / t / 44-threads-too-late.t
index 5eea92a4bf68607e2d7ad9fbedeffa7e0cca68db..f5fa9f4a3751690d9aba0bdac9ad189f04cecee4 100644 (file)
@@ -5,8 +5,25 @@ use warnings;
 
 BEGIN { $ENV{PERL_FORCE_TEST_THREADS} = 1 }
 
-use Test::More tests => 1;
+use Test::More;
 
-local $@;
-eval 'use VPIT::TestHelpers "threads";';
-like $@, qr/was loaded too soon/, 'cannot use the threads feature after Test::More was loaded';
+use Config;
+plan skip_all => 'Cannot test late loading on a non threaded perl'
+                                            unless $Config::Config{useithreads};
+
+plan tests => 2;
+
+{
+ local $@;
+ eval 'use VPIT::TestHelpers "threads";';
+ like $@, qr/^Test::More was loaded too soon/,
+                   'cannot use the threads feature after Test::More was loaded';
+}
+
+SKIP: {
+ local $@;
+ eval { require Test::Leaner; 1 } or skip 'No Test::Leaner available' => 1;
+ eval 'use VPIT::TestHelpers "threads";';
+ like $@, qr/^Test::Leaner was loaded too soon/,
+                 'cannot use the threads feature after Test::Leaner was loaded';
+}