File: too-late-quiet.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 (27 lines) | stat: -rw-r--r-- 604 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
27
use strict;
use warnings;
use Test::More tests => 6;

use lib 't';

my @expected_warnings;
BEGIN {
    push @expected_warnings,
        'Devel::Hide: Too late to hide P.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

# too late to hide P. Q will be hidden, but not mentioned
use_ok('Devel::Hide', '-quiet', 'P', 'Q');

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

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