This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #133649] fails on OpenBSD-6.4 unthreaded
[perl5.git] / t / run / switchM.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require Config;
7     import Config;
8
9 }
10 use strict;
11
12 require './test.pl';
13
14 plan(4);
15
16 like(runperl(switches => ['-Irun/flib', '-Mbroken'], stderr => 1),
17      qr/^Global symbol "\$x" requires explicit package name \(did you (?x:
18         )forget to declare "my \$x"\?\) at run\/flib\/broken.pm line 6\./,
19      "Ensure -Irun/flib produces correct filename in warnings");
20
21 like(runperl(switches => ['-Irun/flib/', '-Mbroken'], stderr => 1),
22      qr/^Global symbol "\$x" requires explicit package name \(did you (?x:
23         )forget to declare "my \$x"\?\) at run\/flib\/broken.pm line 6\./,
24      "Ensure -Irun/flib/ produces correct filename in warnings");
25
26 SKIP: {
27     my $no_pmc;
28     foreach(Config::non_bincompat_options()) {
29         if($_ eq "PERL_DISABLE_PMC"){
30             $no_pmc = 1;
31             last;
32         }
33     }
34
35     if ( $no_pmc ) {
36         skip('Tests fail without PMC support', 2);
37     }
38
39     like(runperl(switches => ['-Irun/flib', '-Mt2'], prog => 'print t2::id()', stderr => 1),
40          qr/^t2pmc$/,
41          "Ensure -Irun/flib loads pmc");
42
43     like(runperl(switches => ['-Irun/flib/', '-Mt2'], prog => 'print t2::id()', stderr => 1),
44          qr/^t2pmc$/,
45          "Ensure -Irun/flib/ loads pmc");
46 }