File Coverage

blib/lib/OOP/Perlish/Class/UnitTests/Meta.pm
Criterion Covered Total %
statement 60 65 92.3
branch n/a
condition n/a
subroutine 16 21 76.1
pod 0 3 0.0
total 76 89 85.3


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 1     1   5 use warnings;
  1         2  
  1         33  
3 1     1   6 use strict;
  1         2  
  1         47  
4             {
5             package OOP::Perlish::Class::Meta::UnitTests::Foo;
6 1     1   5 use OOP::Perlish::Class;
  1         1  
  1         14  
7 1     1   4 use base 'OOP::Perlish::Class';
  1         1  
  1         105  
8              
9             sub foo
10             {
11 0     0     return;
12             }
13             }
14             {
15             package OOP::Perlish::Class::Meta::UnitTests::Bar;
16 1     1   4 use base 'OOP::Perlish::Class::Meta::UnitTests::Foo';
  1         1  
  1         1793  
17             sub bar
18             {
19 0     0     return;
20             }
21             }
22             {
23             package OOP::Perlish::Class::Meta::UnitTests::Baz;
24 1     1   8 use base 'OOP::Perlish::Class::Meta::UnitTests::Bar';
  1         2  
  1         580  
25             sub baz
26             {
27 0     0     return;
28             }
29             }
30             {
31             package OOP::Perlish::Class::Meta::UnitTests::Quux;
32 1     1   5 use base qw(OOP::Perlish::Class::Meta::UnitTests::Baz OOP::Perlish::Class::Meta::UnitTests::Bar);
  1         2  
  1         516  
33              
34             sub quux
35             {
36 0     0     return;
37             }
38             }
39             {
40             package OOP::Perlish::Class::Meta::UnitTests::Thud;
41 1     1   6 use base qw(OOP::Perlish::Class::Meta::UnitTests::Quux OOP::Perlish::Class::Meta::UnitTests::Foo);
  1         3  
  1         509  
42              
43             sub thud
44             {
45 0     0     return;
46             }
47             }
48              
49             {
50             package OOP::Perlish::Class::UnitTests::Meta;
51 1     1   6 use base qw(Test::Class);
  1         1  
  1         61  
52 1     1   5 use Test::More;
  1         2  
  1         8  
53              
54             sub all_isa : Test(7)
55             {
56 1     1 0 1550 my ($self) = @_;
57              
58 1         22 my $n = OOP::Perlish::Class::Meta::UnitTests::Thud->new();
59 1         4 my @correct = ( 'OOP::Perlish::Class::Meta::UnitTests::Thud', 'OOP::Perlish::Class::Meta::UnitTests::Quux', 'OOP::Perlish::Class::Meta::UnitTests::Baz', 'OOP::Perlish::Class::Meta::UnitTests::Bar', 'OOP::Perlish::Class::Meta::UnitTests::Foo', 'OOP::Perlish::Class', ); # results are in order depth-last by Tie::IxHash
60 1         4 my @results = $n->_all_isa();
61              
62 1         32 is(scalar @results, scalar @correct, 'We have the right number of results');
63 1         423 for(my $i=0; $i < scalar @results; $i++) {
64 6         1938 is($results[$i], $correct[$i], "$results[$i] == $correct[$i]");
65             }
66 1     1   466 }
  1         2  
  1         13  
67              
68             sub all_methods : Test(5)
69             {
70 1     1 0 618 my $n = OOP::Perlish::Class::Meta::UnitTests::Thud->new();
71 1         5 my @correct = ( 'thud', 'bar', 'baz', 'quux', 'foo' );
72 1         5 my @results = $n->_all_methods();
73 1         4 my %results_lut;
74 1         28 @results_lut{ @results } = undef;
75              
76 1         3 for(@correct) {
77 5         1391 ok( exists($results_lut{$_}), "We have $_ in our list of methods" );
78             }
79 1     1   374 }
  1         1  
  1         5  
80              
81             sub all_methods_external : Test(5)
82             {
83 1     1 0 525 my $n = OOP::Perlish::Class::Meta::UnitTests::Foo->new();
84 1         5 my @correct = ( 'thud', 'bar', 'baz', 'quux', 'foo' );
85 1         3 my @results = $n->_all_methods('OOP::Perlish::Class::Meta::UnitTests::Thud');
86 1         5 my %results_lut;
87 1         24 @results_lut{ @results } = undef;
88              
89 1         3 for(@correct) {
90 5         1669 ok( exists($results_lut{$_}), "We have $_ in our list of methods" );
91             }
92 1     1   278 }
  1         2  
  1         4  
93             }
94             1;
95              
96             =head1 NAME
97              
98             =head1 VERSION
99              
100             =head1 SYNOPSIS
101              
102             =head1 METHODS
103              
104             =head1 AUTHOR
105              
106             Jamie Beverly, C<< >>
107              
108             =head1 BUGS
109              
110             Please report any bugs or feature requests to C,
111             or through
112             the web interface at
113             L. I will be
114             notified, and then you'll
115             automatically be notified of progress on your bug as I make changes.
116              
117             =head1 SUPPORT
118              
119             You can find documentation for this module with the perldoc command.
120              
121             perldoc OOP::Perlish::Class
122              
123              
124             You can also look for information at:
125              
126             =over 4
127              
128             =item * RT: CPAN's request tracker
129              
130             L
131              
132             =item * AnnoCPAN: Annotated CPAN documentation
133              
134             L
135              
136             =item * CPAN Ratings
137              
138             L
139              
140             =item * Search CPAN
141              
142             L
143              
144             =back
145              
146              
147             =head1 ACKNOWLEDGEMENTS
148              
149             =head1 COPYRIGHT & LICENSE
150              
151             Copyright 2009 Jamie Beverly
152              
153             This program is free software; you can redistribute it and/or modify it
154             under the terms of either: the GNU General Public License as published
155             by the Free Software Foundation; or the Artistic License.
156              
157             See http://dev.perl.org/licenses/ for more information.
158              
159             =cut