xref: /openbsd/gnu/usr.bin/perl/t/run/switchM.t (revision fc61954a)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    @INC = '../lib';
6    require Config;
7    import Config;
8
9}
10use strict;
11
12require './test.pl';
13
14plan(4);
15
16like(runperl(switches => ['-Irun/flib', '-Mbroken'], stderr => 1),
17     qr/^Global symbol "\$x" requires explicit package name at run\/flib\/broken.pm line 6\./,
18     "Ensure -Irun/flib produces correct filename in warnings");
19
20like(runperl(switches => ['-Irun/flib/', '-Mbroken'], stderr => 1),
21     qr/^Global symbol "\$x" requires explicit package name at run\/flib\/broken.pm line 6\./,
22     "Ensure -Irun/flib/ produces correct filename in warnings");
23
24SKIP: {
25    if ( $Config{ccflags} =~ /(?:^|\s)-DPERL_DISABLE_PMC\b/ ) {
26        skip('Tests fail without PMC support', 2);
27    }
28
29    like(runperl(switches => ['-Irun/flib', '-Mt2'], prog => 'print t2::id()', stderr => 1),
30         qr/^t2pmc$/,
31         "Ensure -Irun/flib loads pmc");
32
33    like(runperl(switches => ['-Irun/flib/', '-Mt2'], prog => 'print t2::id()', stderr => 1),
34         qr/^t2pmc$/,
35         "Ensure -Irun/flib/ loads pmc");
36}
37