With Win32 now building DynaLoader in ext, it is now built with
[p5sagit/p5-mst-13.2.git] / cpan / autodie / t / format-clobber.t
CommitLineData
9b657a62 1#!/usr/bin/env perl
2use warnings;
3use strict;
4
5use FindBin;
6use lib "$FindBin::Bin/lib";
7use Test::More tests => 21;
8
9our ($pvio, $pvfm);
10
11use_ok('OtherTypes');
12
13# Since we use use_ok, this is effectively 'compile time'.
14
15ok( defined *OtherTypes::foo{SCALAR},
16 "SCALAR slot intact at compile time" );
17ok( defined *OtherTypes::foo{ARRAY},
18 "ARRAY slot intact at compile time" );
19ok( defined *OtherTypes::foo{HASH},
20 "HASH slot intact at compile time" );
21ok( defined *OtherTypes::foo{IO},
22 "IO slot intact at compile time" );
23ok( defined *OtherTypes::foo{FORMAT},
24 "FORMAT slot intact at compile time" );
25
26is( $OtherTypes::foo, 23,
27 "SCALAR slot correct at compile time" );
28is( $OtherTypes::foo[0], "bar",
29 "ARRAY slot correct at compile time" );
30is( $OtherTypes::foo{mouse}, "trap",
31 "HASH slot correct at compile time" );
32is( *OtherTypes::foo{IO}, $pvio,
33 "IO slot correct at compile time" );
34is( *OtherTypes::foo{FORMAT}, $pvfm,
35 "FORMAT slot correct at compile time" );
36
37eval 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};