1use strict; 2use warnings; 3# HARNESS-NO-PRELOAD 4 5use Test2::Tools::Tiny; 6use Test2::API qw/intercept test2_stack/; 7 8plan 3; 9 10my @warnings; 11{ 12 local $SIG{__WARN__} = sub { push @warnings => @_ }; 13 require Test::Builder; 14}; 15 16is(@warnings, 2, "got warnings"); 17 18like( 19 $warnings[0], 20 qr/Test::Builder was loaded after Test2 initialization, this is not recommended/, 21 "Warn about late Test::Builder load" 22); 23 24like( 25 $warnings[1], 26 qr/Formatter Test::Builder::Formatter loaded too late to be used as the global formatter/, 27 "Got the formatter warning" 28); 29