Upgrade to Attribute::Handlers 0.87 (which is just a core sync) -- for real
[p5sagit/p5-mst-13.2.git] / ext / Package-Constants / t / 01_list.t
CommitLineData
1a04e791 1use strict;
2use Test::More 'no_plan';
3
4BEGIN { chdir 't' if -d 't' };
5use lib '../lib';
6
7my $Class = 'Package::Constants';
8my $Func = 'list';
9my $Pkg = '_test';
10my @Good = 'A'..'C';
11my @Bad = 'D'..'E';
12
13use_ok( $Class );
14can_ok( $Class, $Func );
15
16### enable debug statements?
17$Package::Constants::DEBUG = $Package::Constants::DEBUG = @ARGV ? 1 : 0;
18
19
20### small test class
21{ package _test;
22
23 ### mark us as loaded
24 $INC{'_test.pm'} = $0;
25
26 use vars qw[$FOO];
27 $FOO = 1;
28
29 ### define various subs.. the first 3 are constants,
30 ### the others are not
31 use constant A => 1;
32 use constant B => sub { 1 };
33 sub C () { 1 };
34
35 sub D { 1 };
36 sub E (*) { 1 };
37
38}
39
40### get the list
41{ my @list = $Class->$Func( $Pkg );
42 ok( scalar(@list), "Got a list of constants" );
43 is_deeply( \@list, \@Good, " Contains all expected entries" );
44}
45
46
47# Local variables:
48# c-indentation-style: bsd
49# c-basic-offset: 4
50# indent-tabs-mode: nil
51# End:
52# vim: expandtab shiftwidth=4: