From: Vincent Pit Date: Fri, 17 Jul 2015 21:46:19 +0000 (-0300) Subject: Also test no indirect fatal and compilation errors in require X-Git-Tag: v0.36~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=03bcfb394b73ec0af103d5afadb16aa3c30df109;p=perl%2Fmodules%2Findirect.git Also test no indirect fatal and compilation errors in require --- diff --git a/MANIFEST b/MANIFEST index 5484282..2b6fc4a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -39,6 +39,7 @@ t/lib/indirect/Test2.pm t/lib/indirect/Test3.pm t/lib/indirect/Test4.pm t/lib/indirect/Test5.pm +t/lib/indirect/TestCompilationError.pm t/lib/indirect/TestRequired1.pm t/lib/indirect/TestRequired2.pm t/lib/indirect/TestRequired3X.pm diff --git a/t/33-compilation-errors.t b/t/33-compilation-errors.t index be01768..eb2af02 100644 --- a/t/33-compilation-errors.t +++ b/t/33-compilation-errors.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 5; use lib 't/lib'; use VPIT::TestHelpers 'capture'; @@ -26,6 +26,7 @@ my $indirect_msg = qr/Indirect call of method "baz" on object "\$_"/; my $core_err1 = qr/Global symbol "\$bar"/; my $core_err2 = qr/Global symbol "\$ook"/; my $aborted = qr/Execution of -e aborted due to compilation errors\./; +my $failed_req = qr/Compilation failed in require/; my $line_end = qr/[^\n]*\n/; my $compile_err_warn_exp = qr/$indirect_msg$line_end$core_err2$line_end/o; my $compile_err_fatal_exp = qr/$core_err1$line_end$indirect_msg$line_end/o; @@ -58,3 +59,10 @@ SKIP: { like $@, qr/\A$compile_err_fatal_exp\z/o, 'no indirect fatal does not hide compilation errors inside of eval'; } + +{ + local $@; + eval { require indirect::TestCompilationError }; + like $@, qr/\A$compile_err_fatal_exp$failed_req$line_end\z/o, + 'no indirect fatal does not hide compilation errors inside of require'; +} diff --git a/t/lib/indirect/TestCompilationError.pm b/t/lib/indirect/TestCompilationError.pm new file mode 100644 index 0000000..37b9975 --- /dev/null +++ b/t/lib/indirect/TestCompilationError.pm @@ -0,0 +1,8 @@ +package indirect::TestCompilationError; +use strict; +use warnings; +no indirect 'fatal'; +sub foo { $bar } +baz $_; +sub qux { $ook } +1