]> git.vpit.fr Git - perl/modules/VPIT-TestHelpers.git/blob - 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
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 BEGIN { $ENV{PERL_FORCE_TEST_THREADS} = 1 }
7
8 use Test::More;
9
10 use Config;
11 plan skip_all => 'Cannot test late loading on a non threaded perl'
12                                             unless $Config::Config{useithreads};
13
14 plan tests => 2;
15
16 {
17  local $@;
18  eval 'use VPIT::TestHelpers "threads";';
19  like $@, qr/^Test::More was loaded too soon/,
20                    'cannot use the threads feature after Test::More was loaded';
21 }
22
23 SKIP: {
24  local $@;
25  eval { require Test::Leaner; 1 } or skip 'No Test::Leaner available' => 1;
26  eval 'use VPIT::TestHelpers "threads";';
27  like $@, qr/^Test::Leaner was loaded too soon/,
28                  'cannot use the threads feature after Test::Leaner was loaded';
29 }