xref: /openbsd/gnu/usr.bin/perl/t/run/switchM.t (revision e5dd7070)
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 \(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
21like(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
26SKIP: {
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}
47