Class/UnitTests/Meta.pm

filter: Statementstmt 93.0% 67 / 72 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 76.1% 16 / 21 Podpod 0.0% 0 / 3 totaltotal 86.7% 85 / 98 CC 4 SCAR 3.8
CC
4
Cov
93%
foo
2.0
bar
2.0
baz
2.0
CRAP 1.5
« Class/Singleton.pm ↑ Summary Class/Accessor/UnitTests/ScalarRef.pm »
1 #!/usr/bin/perl
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 {
5 package OOP::Perlish::Class::Meta::UnitTests::Foo;
6 1 ▶ use OOP::Perlish::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ use base 'OOP::Perlish::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub foo
10 0 ▶ {
Subroutine foo: not called CC=1 SCAR=6.9
11 0 return;
12 }
13 }
14 {
15 1 package OOP::Perlish::Class::Meta::UnitTests::Bar;
16 1 ▶ use base 'OOP::Perlish::Class::Meta::UnitTests::Foo';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 sub bar
18 0 ▶ {
Subroutine bar: not called CC=1 SCAR=6.9
19 0 return;
20 }
21 }
22 {
23 1 package OOP::Perlish::Class::Meta::UnitTests::Baz;
24 1 ▶ use base 'OOP::Perlish::Class::Meta::UnitTests::Bar';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 sub baz
26 0 ▶ {
Subroutine baz: not called CC=1 SCAR=6.9
27 0 return;
28 }
29 }
30 {
31 1 package OOP::Perlish::Class::Meta::UnitTests::Quux;
32 1 ▶ use base qw(OOP::Perlish::Class::Meta::UnitTests::Baz OOP::Perlish::Class::Meta::UnitTests::Bar);
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 sub quux
35 0 ▶ {
Subroutine quux: not called CC=1 SCAR=6.9
36 0 return;
37 }
38 }
39 {
40 1 package OOP::Perlish::Class::Meta::UnitTests::Thud;
41 1 ▶ use base qw(OOP::Perlish::Class::Meta::UnitTests::Quux OOP::Perlish::Class::Meta::UnitTests::Foo);
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 sub thud
44 0 ▶ {
Subroutine thud: not called CC=1 SCAR=6.9
45 0 return;
46 }
47 }
48  
49 {
50 1 package OOP::Perlish::Class::UnitTests::Meta;
51 1 ▶ use base qw(Test::Class);
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶ use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 1 ▶ sub all_isa : Test(7)
Subroutine all_isa: called CC=2 SCAR=6.9
Pod undocumented
55 {
56 1 my ($self) = @_;
57  
58 1 my $n = OOP::Perlish::Class::Meta::UnitTests::Thud->new();
59 1 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 my @results = $n->_all_isa();
61  
62 1 is(scalar @results, scalar @correct, 'We have the right number of results');
63 1 ▶ for(my $i=0; $i < scalar @results; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @results) 6 1 7
64 6 is($results[$i], $correct[$i], "$results[$i] == $correct[$i]");
65 }
66 1 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
67  
68 1 ▶ sub all_methods : Test(5)
Subroutine all_methods: called CC=2 SCAR=6.9
Pod undocumented
69 {
70 1 my $n = OOP::Perlish::Class::Meta::UnitTests::Thud->new();
71 1 my @correct = ( 'thud', 'bar', 'baz', 'quux', 'foo' );
72 1 my @results = $n->_all_methods();
73 1 my %results_lut;
74 1 @results_lut{ @results } = undef;
75  
76 1 for(@correct) {
77 5 ok( exists($results_lut{$_}), "We have $_ in our list of methods" );
78 }
79 1 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 1 ▶ sub all_methods_external : Test(5)
Subroutine all_methods_external: called CC=2 SCAR=6.9
Pod undocumented
82 {
83 1 my $n = OOP::Perlish::Class::Meta::UnitTests::Foo->new();
84 1 my @correct = ( 'thud', 'bar', 'baz', 'quux', 'foo' );
85 1 my @results = $n->_all_methods('OOP::Perlish::Class::Meta::UnitTests::Thud');
86 1 my %results_lut;
87 1 @results_lut{ @results } = undef;
88  
89 1 for(@correct) {
90 5 ok( exists($results_lut{$_}), "We have $_ in our list of methods" );
91 }
92 1 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
93 }
94 1 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<< <jbeverly at cpan.org> >>
107  
108 =head1 BUGS
109  
110 Please report any bugs or feature requests to C<bug-foo-bar at rt.cpan.org>,
111 or through
112 the web interface at
113 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=OOP-Perlish-Class>. 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=OOP-Perlish-Class>
131  
132 =item * AnnoCPAN: Annotated CPAN documentation
133  
134 L<http://annocpan.org/dist/OOP-Perlish-Class>
135  
136 =item * CPAN Ratings
137  
138 L<http://cpanratings.perl.org/d/OOP-Perlish-Class>
139  
140 =item * Search CPAN
141  
142 L<http://search.cpan.org/dist/OOP-Perlish-Class/>
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
« Class/Singleton.pm ↑ Summary Class/Accessor/UnitTests/ScalarRef.pm »