This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update the Change log in Module::CoreList to include recent commits
[perl5.git] / cpan / autodie / t / format-clobber.t
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 use FindBin;
6 use lib "$FindBin::Bin/lib";
7 use Test::More tests => 21;
8
9 our ($pvio, $pvfm);
10
11 use_ok('OtherTypes');
12
13 # Since we use use_ok, this is effectively 'compile time'.
14
15 ok( defined *OtherTypes::foo{SCALAR},
16     "SCALAR slot intact at compile time" );
17 ok( defined *OtherTypes::foo{ARRAY},
18     "ARRAY slot intact at compile time" );
19 ok( defined *OtherTypes::foo{HASH},
20     "HASH slot intact at compile time" );
21 ok( defined *OtherTypes::foo{IO},
22     "IO slot intact at compile time" );
23 ok( defined *OtherTypes::foo{FORMAT},
24     "FORMAT slot intact at compile time" );
25
26 is( $OtherTypes::foo, 23,
27     "SCALAR slot correct at compile time" );
28 is( $OtherTypes::foo[0], "bar",
29     "ARRAY slot correct at compile time" );
30 is( $OtherTypes::foo{mouse}, "trap",
31     "HASH slot correct at compile time" );
32 is( *OtherTypes::foo{IO}, $pvio,
33     "IO slot correct at compile time" );
34 is( *OtherTypes::foo{FORMAT}, $pvfm,
35     "FORMAT slot correct at compile time" );
36
37 eval q{
38     ok( defined *OtherTypes::foo{SCALAR},
39         "SCALAR slot intact at run time" );
40     ok( defined *OtherTypes::foo{ARRAY},
41         "ARRAY slot intact at run time" );
42     ok( defined *OtherTypes::foo{HASH},
43         "HASH slot intact at run time" );
44     ok( defined *OtherTypes::foo{IO},
45         "IO slot intact at run time" );
46
47     TODO: {
48         local $TODO = "Copying formats fails due to a bug in Perl.";
49         ok( defined *OtherTypes::foo{FORMAT},
50             "FORMAT slot intact at run time" );
51     }
52
53     is( $OtherTypes::foo, 23,
54         "SCALAR slot correct at run time" );
55     is( $OtherTypes::foo[0], "bar",
56         "ARRAY slot correct at run time" );
57     is( $OtherTypes::foo{mouse}, "trap",
58         "HASH slot correct at run time" );
59     is( *OtherTypes::foo{IO}, $pvio,
60         "IO slot correct at run time" );
61
62     TODO: {
63         local $TODO = "Copying formats fails due to a bug in Perl.";
64         is( *OtherTypes::foo{FORMAT}, $pvfm,
65             "FORMAT slot correct at run time" );
66     }
67 };