line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Harness::Assert; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
require Exporter; |
5
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @EXPORT @ISA); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
161
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
@EXPORT = qw(assert); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Test::Harness::Assert - simple assert |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
### FOR INTERNAL USE ONLY ### |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Test::Harness::Assert; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
assert( EXPR, $name ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
A simple assert routine since we don't have Carp::Assert handy. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
B |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 FUNCTIONS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 C |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
assert( EXPR, $name ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
If the expression is false the program aborts. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub assert ($;$) { |
42
|
48602
|
|
|
48602
|
1
|
86649
|
my($assert, $name) = @_; |
43
|
|
|
|
|
|
|
|
44
|
48602
|
50
|
|
|
|
104473
|
unless( $assert ) { |
45
|
0
|
|
|
|
|
|
require Carp; |
46
|
0
|
|
|
|
|
|
my $msg = 'Assert failed'; |
47
|
0
|
0
|
|
|
|
|
$msg .= " - '$name'" if defined $name; |
48
|
0
|
|
|
|
|
|
$msg .= '!'; |
49
|
0
|
|
|
|
|
|
Carp::croak($msg); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Michael G Schwern C<< >> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |