line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
# $URL$ |
3
|
|
|
|
|
|
|
# $Date$ |
4
|
|
|
|
|
|
|
# $Author$ |
5
|
|
|
|
|
|
|
# $Revision$ |
6
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
7
|
|
|
|
|
|
|
package Wetware::Test::Suite; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
75163
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
70
|
|
10
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
50
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
172
|
|
13
|
2
|
|
|
2
|
|
1128
|
use Test::More; |
|
2
|
|
|
|
|
7613
|
|
|
2
|
|
|
|
|
18
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
1822
|
use Wetware::Test::Class; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
73
|
|
16
|
2
|
|
|
2
|
|
13
|
use base q{Wetware::Test::Class}; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
381
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = 0.04; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
1
|
302
|
sub class_under_test { Carp::confess('Must override in sub-class.') } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
25
|
|
|
|
|
|
|
# STOP!!!! DO NOT LOAD ANY tests into this Class! Since This Class |
26
|
|
|
|
|
|
|
# has the exception that will be THROWN IF class_under_test() is |
27
|
|
|
|
|
|
|
# called, and the 'Test()' will force the call to _apply_handler_AH_() |
28
|
|
|
|
|
|
|
# in Attributes::Handlers.... |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# Wished i could find a simpler way. But, that gave me the idea for |
31
|
|
|
|
|
|
|
# doing the Wetare::Test::CreateTestSuite |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
# REPEAT! This is a problem with the 'use thing that inherits this' |
34
|
|
|
|
|
|
|
# it is not a problem with the calling 'code' |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
# sub test_new : Test(1) { |
37
|
|
|
|
|
|
|
# my $self = shift; |
38
|
|
|
|
|
|
|
# my $object = $self->object_under_test(); |
39
|
|
|
|
|
|
|
# my $expected_class = $self->class_under_test(); |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# Test::More::isa_ok( $object, $expected_class ); |
42
|
|
|
|
|
|
|
# return $self; |
43
|
|
|
|
|
|
|
# } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub set_up : Test(setup) { |
48
|
3
|
|
|
3
|
1
|
1672
|
my ($self, %params) = @_; |
49
|
3
|
|
|
|
|
18
|
$self->new_object_under_test_for(%params); |
50
|
3
|
|
|
|
|
20
|
return $self; |
51
|
2
|
|
|
2
|
|
11
|
} |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
30
|
|
52
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new_object_under_test_for { |
55
|
4
|
|
|
4
|
1
|
2550
|
my ($self, %params) = @_; |
56
|
4
|
|
|
|
|
17
|
my $class = $self->class_under_test(); |
57
|
4
|
|
|
|
|
28
|
$self->{$class} = $class->new(%params); |
58
|
4
|
|
|
|
|
17
|
return $self->{$class}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub object_under_test { |
63
|
1
|
|
|
1
|
1
|
173
|
my $self = shift; |
64
|
1
|
|
|
|
|
4
|
my $class = $self->class_under_test(); |
65
|
1
|
|
|
|
|
7
|
return $self->{$class}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub tear_down : Test(teardown) { |
70
|
3
|
|
|
3
|
1
|
5380
|
my $self = shift; |
71
|
3
|
|
|
|
|
17
|
my $class = $self->class_under_test(); |
72
|
3
|
|
|
|
|
24
|
delete $self->{$class}; # the $class needs to be deleted from $self. |
73
|
3
|
|
|
|
|
11
|
return $self; |
74
|
2
|
|
|
2
|
|
968
|
} |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
75
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |