1use Test2::Tools::Tiny; 2use strict; 3use warnings; 4 5skip_all("Test cannot run on perls below 5.8.8") unless "$]" > 5.008007; 6 7use Test2::Util qw/CAN_THREAD/; 8use Test2::IPC; 9use Test2::API qw/context intercept/; 10 11skip_all('System does not have threads') unless CAN_THREAD(); 12 13require threads; 14threads->import; 15 16my $events = intercept { 17 threads->create( 18 sub { 19 ok 1, "something $_ nonlocal" for (1 .. 15); 20 } 21 )->join; 22}; 23 24is_deeply( 25 [map { $_->{name} } @$events], 26 [map "something $_ nonlocal", 1 .. 15], 27 "Culled sub-thread events in correct order" 28); 29 30done_testing; 31