File: base.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 (67 lines) | stat: -rw-r--r-- 1,144 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! perl

use Test::More 0.98;

BEGIN
{
    local $INC{'IO/File.pm'};
    local $INC{'IO/Handle.pm'};

    use_ok( 'Modern::Perl' ) or exit;
    ok exists $INC{'IO/File.pm'},   'M::P should load IO::File';
    ok exists $INC{'IO/Handle.pm'}, 'M::P should load IO::Handle';

    Modern::Perl->import();
}

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

eval '$x = 1;';
like( $@, qr/Global symbol "\$x" requires explicit/,
    'strict should be enabled' );

my $warnings;
local $SIG{__WARN__} = sub { $warnings = shift };
my $y =~ s/hi//;
like( $warnings, qr/Use of uninitialized value/, 'warnings should be enabled' );

eval<<'END_CLASSES';

package A;

$A::VERSION = 1;

package B;

@B::ISA = 'A';

package C;

@C::ISA = 'A';

package D;

use Modern::Perl;

@D::ISA = qw( B C );

END_CLASSES

package main;

is_deeply( mro::get_linear_isa( 'D' ), [qw( D B C A )], 'mro should use C3' );

if ($] > 5.011003)
{
    eval q|
    use Modern::Perl;
    BEGIN
    {
      ok exists $^H{feature_unicode},
        '... and should unilaterally enable unicode_strings, when available';
    }
    |;
}

done_testing;