line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Unit::Assertion::Boolean; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# adding this fixes the 'Can't locate object method "fail" via package |
6
|
|
|
|
|
|
|
# "Test::Unit::Assertion::Boolean"' problem under perl 5.005 - Christian |
7
|
2
|
|
|
2
|
|
10
|
use Test::Unit::Assertion; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
36
|
|
8
|
2
|
|
|
2
|
|
11
|
use Test::Unit::Failure; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
112
|
use base 'Test::Unit::Assertion'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
250
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
11
|
use overload 'bool' => sub {$ {$_[0]}}; |
|
2
|
|
|
20
|
|
4
|
|
|
2
|
|
|
|
|
32
|
|
|
20
|
|
|
|
|
25
|
|
|
20
|
|
|
|
|
67
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
78
|
|
|
78
|
1
|
127
|
my $class = shift; |
17
|
78
|
|
|
|
|
138
|
my $bool = shift; |
18
|
|
|
|
|
|
|
|
19
|
78
|
|
|
|
|
123
|
my $self = \$bool; |
20
|
78
|
|
|
|
|
484
|
bless $self, $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub do_assertion { |
24
|
78
|
|
|
78
|
1
|
99
|
my $self = shift; |
25
|
78
|
100
|
|
|
|
301
|
$$self or $self->fail( @_ ? join('', @_) : "Boolean assertion failed"); |
|
|
100
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_string { |
29
|
78
|
|
|
78
|
0
|
109
|
my $self = shift; |
30
|
78
|
100
|
|
|
|
502
|
($$self ? 'TRUE' : 'FALSE') . ' boolean assertion'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |