File: unimport.t

package info (click to toggle)
libmodern-perl-perl 1.20241001-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: perl: 623; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (4)
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
28
29
#! perl

use Test::More 0.98;
use Modern::Perl;

if ($ENV{PERL5OPT}) {
    plan( skip_all => "Cannot reliably test with PERL5OPT set" );
    exit 0;
}

eval 'say "# say() should be available";';
is $@, '', 'say() should be available';

{
    no Modern::Perl;
    eval 'say "# say() should be unavailable when unimported"';
    like $@, qr/syntax error.+near "say /,
        'unimport should disable say feature';
    eval '$x = 1';
    is $@, '', 'unimport should disable strictures';

    my $warnings;
    local $SIG{__WARN__} = sub { $warnings = shift };
    my $y =~ s/hi//;
    unlike $warnings, qr/Use of uninitialized value/,
        'unimport should disable warnings';
}

done_testing;