s/Stash::Manip/Package::Stash/g
[p5sagit/namespace-clean.git] / t / 06-other-types.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 => 17;
8
9 our $pvio;
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
24 is( $OtherTypes::foo, 23,
25     "SCALAR slot correct at compile time" );
26 is( $OtherTypes::foo[0], "bar",
27     "ARRAY slot correct at compile time" );
28 is( $OtherTypes::foo{mouse}, "trap",
29     "HASH slot correct at compile time" );
30 is( *OtherTypes::foo{IO}, $pvio,
31     "IO slot correct at compile time" );
32
33 eval q{
34     ok( defined *OtherTypes::foo{SCALAR},
35         "SCALAR slot intact at run time" );
36     ok( defined *OtherTypes::foo{ARRAY},
37         "ARRAY slot intact at run time" );
38     ok( defined *OtherTypes::foo{HASH},
39         "HASH slot intact at run time" );
40     ok( defined *OtherTypes::foo{IO},
41         "IO slot intact at run time" );
42
43     is( $OtherTypes::foo, 23,
44         "SCALAR slot correct at run time" );
45     is( $OtherTypes::foo[0], "bar",
46         "ARRAY slot correct at run time" );
47     is( $OtherTypes::foo{mouse}, "trap",
48         "HASH slot correct at run time" );
49     is( *OtherTypes::foo{IO}, $pvio,
50         "IO slot correct at run time" );
51 };