| 1 | 5 | ▶ | use 5.008; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Class::Scaffold::Test; | ||
| 6 | 5 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 5 | $Class::Scaffold::Test::VERSION = '1.102280'; | |
| 8 | } | ||
| 9 | # ABSTRACT: Base classes for framework test classes | ||
| 10 | 5 | ▶ | use Test::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 0 | ▶ | use Class::Value; # see run() below |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 12 | |||
| 13 | # Also inherit from Class::Scaffold::Base so we get a delegate; put it first | ||
| 14 | # so its new() is found, not the very basic new() from Project::Build::Test | ||
| 15 | use parent qw( | ||
| 16 | Class::Scaffold::Base | ||
| 17 | Test::CompanionClasses::Base | ||
| 18 | ); | ||
| 19 | use constant PLAN => 1; | ||
| 20 | |||
| 21 | sub obj_ok { | ||
| 22 | my ($self, $object, $object_type_const) = @_; | ||
| 23 | isa_ok($object, $self->delegate->get_class_name_for($object_type_const)); | ||
| 24 | } | ||
| 25 | |||
| 26 | # Override planned_test_count() with a version that uses every_list(). | ||
| 27 | # Project::Build::Test->planned_test_count() couldn't use that because | ||
| 28 | # every_list() is implemented in Data::Inherited, which in turn uses | ||
| 29 | # Project::Build. | ||
| 30 | sub planned_test_count { | ||
| 31 | my $self = shift; | ||
| 32 | my $plan; | ||
| 33 | |||
| 34 | # so that PLANs can use the delegate: | ||
| 35 | $::delegate = $self->delegate; | ||
| 36 | $plan += $_ for $self->every_list('PLAN'); | ||
| 37 | $plan; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub run { | ||
| 41 | my $self = shift; | ||
| 42 | $self->SUPER::run(@_); | ||
| 43 | |||
| 44 | # check that test prerequisites are ok | ||
| 45 | is($Class::Value::SkipChecks, 1, '$Class::Value::SkipChecks is on'); | ||
| 46 | } | ||
| 47 | 1; | ||
| 48 | |||
| 49 | |||
| 50 | __END__ | ||