File Coverage

blib/lib/OOP/Perlish/Class/Accessor/UnitTests/Constructor.pm
Criterion Covered Total %
statement 33 33 100.0
branch 2 4 50.0
condition n/a
subroutine 10 10 100.0
pod 0 3 0.0
total 45 50 90.0


line stmt bran cond sub pod time code
1             {
2              
3             package OOP::Perlish::Class::Accessor::UnitTests::Constructor;
4 1     1   8 use Test::Class;
  1         2  
  1         34  
5 1     1   6 use base qw(Test::Class);
  1         2  
  1         93  
6              
7 1     1   6 use OOP::Perlish::Class::Accessor;
  1         4  
  1         8  
8 1     1   6 use Test::More;
  1         1  
  1         7  
9              
10             sub invalid_type : Test
11             {
12 1     1 0 1376 my ($self) = @_;
13 1         2 eval { OOP::Perlish::Class::Accessor->new( type => 'ASDF', name => 'test' ); };
  1         9  
14 1         603 ok( "$@" =~ m/Invalid type specified/gsm, "We confess on invalid type" );
15 1     1   474 }
  1         2  
  1         7  
16              
17             sub missing_type : Test
18             {
19 1     1 0 658 my ($self) = @_;
20 1         2 eval { OOP::Perlish::Class::Accessor->new( name => 'test' ); };
  1         9  
21 1 50       449 ok( "$@" =~ m/Missing required field type/gsm, "We confess on missing required 'type' parameter" ) || diag("$@");
22 1     1   366 }
  1         3  
  1         5  
23              
24             sub missing_name : Test
25             {
26 1     1 0 766 my ($self) = @_;
27 1         3 eval { OOP::Perlish::Class::Accessor->new( type => 'SCALAR' ); };
  1         7  
28 1 50       433 ok( "$@" =~ m/Missing required field name/gsim, "We confess on missing required 'name' parameter" ) || diag("$@");
29 1     1   336 }
  1         2  
  1         5  
30             }
31             1;
32              
33             =head1 NAME
34              
35             =head1 VERSION
36              
37             =head1 SYNOPSIS
38              
39             =head1 METHODS
40              
41             =head1 AUTHOR
42              
43             Jamie Beverly, C<< >>
44              
45             =head1 BUGS
46              
47             Please report any bugs or feature requests to C,
48             or through
49             the web interface at
50             L. I will be
51             notified, and then you'll
52             automatically be notified of progress on your bug as I make changes.
53              
54             =head1 SUPPORT
55              
56             You can find documentation for this module with the perldoc command.
57              
58             perldoc OOP::Perlish::Class
59              
60              
61             You can also look for information at:
62              
63             =over 4
64              
65             =item * RT: CPAN's request tracker
66              
67             L
68              
69             =item * AnnoCPAN: Annotated CPAN documentation
70              
71             L
72              
73             =item * CPAN Ratings
74              
75             L
76              
77             =item * Search CPAN
78              
79             L
80              
81             =back
82              
83              
84             =head1 ACKNOWLEDGEMENTS
85              
86             =head1 COPYRIGHT & LICENSE
87              
88             Copyright 2009 Jamie Beverly
89              
90             This program is free software; you can redistribute it and/or modify it
91             under the terms of either: the GNU General Public License as published
92             by the Free Software Foundation; or the Artistic License.
93              
94             See http://dev.perl.org/licenses/ for more information.
95              
96             =cut