This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ext/B/t/strict.t: Assure B.pm and O.pm pass strict and warnings checks.
authorTodd Rinaldo <toddr@cpan.org>
Wed, 13 Sep 2017 19:35:39 +0000 (14:35 -0500)
committerTodd Rinaldo <toddr@cpanel.net>
Wed, 8 Nov 2017 22:36:16 +0000 (16:36 -0600)
We need to test these in unit tests since they do not load these modules to
prevent pollution of the stash in compilers.

MANIFEST
ext/B/t/strict.t [new file with mode: 0644]

index cfa1ecd..465df5d 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3962,6 +3962,7 @@ ext/B/t/optree_varinit.t  my,our,local var init optimization
 ext/B/t/OptreeCheck.pm         optree comparison tool
 ext/B/t/pragma.t       See if user pragmas work.
 ext/B/t/showlex.t      See if B::ShowLex works
+ext/B/t/strict.t       See if B works with strict and warnings.
 ext/B/t/sv_stash.t     See if SvSTASH() works
 ext/B/t/terse.t                See if B::Terse works
 ext/B/t/walkoptree.t   See if B::walkoptree (and friends) work
diff --git a/ext/B/t/strict.t b/ext/B/t/strict.t
new file mode 100644 (file)
index 0000000..4d1b84a
--- /dev/null
@@ -0,0 +1,30 @@
+#!./perl -w
+
+use strict;
+use warnings;
+
+use Config;
+use Test::More;
+
+BEGIN {
+    if ( ( $Config{'extensions'} !~ /\sB\s/ ) ) {
+        plan skip_all => "Perl was not compiled with B";
+        exit 0;
+    }
+}
+
+use strict;
+use warnings;
+
+use B ();
+use O ();
+
+foreach my $module (qw/B O/) {
+    my $path  = $INC{ $module . '.pm' };
+    my $check = "$^X -cw -Mstrict $path 2>&1";
+    my $got   = `$check`;
+    is( $got, "$path syntax OK\n", "$module.pm compiles without errors" )
+      or diag($got);
+}
+
+done_testing();