File: 006before.t

package info (click to toggle)
libdevel-hide-perl 0.0015-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 211; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 590 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use warnings;
use Test::More tests => 7;

use lib 't';

my @expected_warnings;
BEGIN {
    push @expected_warnings,
        'Devel::Hide: Too late to hide P.pm',
        'Devel::Hide hides Q.pm';
    $SIG{__WARN__} = sub {
        ok($_[0] eq shift(@expected_warnings)."\n",
            "got expected warning: $_[0]");
    }
}
END { ok(!@expected_warnings, "got all expected warnings") }

use_ok('P'); # loads P
use_ok('Devel::Hide', 'P', 'Q'); # too late to hide P

eval { require P }; 
ok(!$@, "P was loaded (as it should)");

eval { require Q }; 
ok($@, "Q was not loaded");