File: unimport.t

package info (click to toggle)
libmodern-perl-perl 1.20120521-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 116 kB
  • sloc: perl: 289; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! perl

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

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;