| 1 | 1 | ▶ | use 5.008; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 Class::Scaffold::Base_TEST; | ||
| 6 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | $Class::Scaffold::Base_TEST::VERSION = '1.102280'; | |
| 8 | } | ||
| 9 | # ABSTRACT: Test companion class for the general base class | ||
| 10 | 1 | ▶ | use Error::Hierarchy::Test 'throws2_ok'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use Test::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use parent 'Class::Scaffold::Test'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | use constant PLAN => 4; | ||
| 14 | |||
| 15 | sub run { | ||
| 16 | my $self = shift; | ||
| 17 | $self->SUPER::run(@_); | ||
| 18 | my $obj = $self->make_real_object; | ||
| 19 | isa_ok($obj->delegate, 'Class::Scaffold::Environment'); | ||
| 20 | isa_ok($obj->log, 'Class::Scaffold::Log'); | ||
| 21 | throws2_ok { $obj->foo } | ||
| 22 | '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 | undef $@; | ||
| 30 | throws2_ok { Class::Scaffold::Does::Not::Exist->new } | ||
| 31 | '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__ | ||