File Coverage

blib/lib/Class/Scaffold/Base_TEST.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod 1 1 100.0
total 44 44 100.0


line stmt bran cond sub pod time code
1 1     1   1757 use 5.008;
  1         4  
  1         34  
2 1     1   6 use warnings;
  1         2  
  1         38  
3 1     1   4 use strict;
  1         3  
  1         50  
4              
5             package Class::Scaffold::Base_TEST;
6             BEGIN {
7 1     1   17 $Class::Scaffold::Base_TEST::VERSION = '1.102280';
8             }
9             # ABSTRACT: Test companion class for the general base class
10 1     1   832 use Error::Hierarchy::Test 'throws2_ok';
  1         4503  
  1         55  
11 1     1   8 use Test::More;
  1         2  
  1         11  
12 1     1   255 use parent 'Class::Scaffold::Test';
  1         2  
  1         8  
13 1     1   73 use constant PLAN => 4;
  1         2  
  1         335  
14              
15             sub run {
16 1     1 1 6 my $self = shift;
17 1         9 $self->SUPER::run(@_);
18 1         383 my $obj = $self->make_real_object;
19 1         35 isa_ok($obj->delegate, 'Class::Scaffold::Environment');
20 1         366 isa_ok($obj->log, 'Class::Scaffold::Log');
21 1     1   75 throws2_ok { $obj->foo }
22 1         476 'Error::Simple',
23             qr/^Undefined subroutine &Class::Scaffold::Base::foo called at/,
24             'call to undefined subroutine caught by UNIVERSAL::AUTOLOAD';
25              
26             # Undef the existing error. Strangely necessary, otherwise the next
27             # ->make_real_object dies with the error message still in $@, although the
28             # require() in ->make_real_object should have cleared it on success...
29 1         3590 undef $@;
30 1     1   47 throws2_ok { Class::Scaffold::Does::Not::Exist->new }
31 1         10 'Error::Hierarchy::Internal::CustomMessage',
32             qr/Couldn't load package \[Class::Scaffold::Does::Not::Exist\]:/,
33             'call to undefined package caught by UNIVERSAL::AUTOLOAD';
34             }
35             1;
36              
37              
38             __END__