]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Also test no indirect fatal and compilation errors in require
authorVincent Pit <vince@profvince.com>
Fri, 17 Jul 2015 21:46:19 +0000 (18:46 -0300)
committerVincent Pit <vince@profvince.com>
Fri, 17 Jul 2015 21:46:19 +0000 (18:46 -0300)
MANIFEST
t/33-compilation-errors.t
t/lib/indirect/TestCompilationError.pm [new file with mode: 0644]

index 5484282305fee5a8d168a51bfb8bf57878191a21..2b6fc4a52d909c8c15f06382221d8267cdcdee95 100644 (file)
--- 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
index be01768a99c07a1af6a155c49723c40d9773a9f2..eb2af021cd943a5c0e1a16f056c7591791a8cc93 100644 (file)
@@ -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 (file)
index 0000000..37b9975
--- /dev/null
@@ -0,0 +1,8 @@
+package indirect::TestCompilationError;
+use strict;
+use warnings;
+no indirect 'fatal';
+sub foo { $bar }
+baz $_;
+sub qux { $ook }
+1