Debian Codegraph @

cpan/Test2-Suite/t/modules/Require/Threads.t

raw
1 use strict;
2 use warnings;
3
4 # Prevent Test2::Util from making 'CAN_THREAD' a constant
5 my $threads;
6 BEGIN {
7 require Test2::Util;
8 local $SIG{__WARN__} = sub { 1 }; # no warnings is not sufficient on older perls
9 *Test2::Util::CAN_THREAD = sub { $threads };
10 }
11
12 use Test2::Bundle::Extended -target => 'Test2::Require::Threads';
13
14 {
15 $threads = 0;
16 is($CLASS->skip(), 'This test requires a perl capable of threading.', "will skip");
17
18 $threads = 1;
19 is($CLASS->skip(), undef, "will not skip");
20 }
21
22 done_testing;