line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Run::Assert; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
77
|
use strict; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
380
|
|
4
|
14
|
|
|
14
|
|
73
|
use warnings; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
556
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
14
|
|
|
14
|
|
76
|
use vars qw($VERSION @EXPORT @ISA); |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
2495
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.0304'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
@EXPORT = qw(assert); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Test::Run::Assert - A Simple Assert Function. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNPOSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
B<This module is only for internal use>. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Test::Run::Assert; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
assert ( EXPR , $name ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 EXPORTS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 assert($condition, $name) |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
If condition is false - croak with the description $name. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub assert($;$) |
35
|
|
|
|
|
|
|
{ |
36
|
16
|
|
|
16
|
1
|
62
|
my ($condition, $name) = @_; |
37
|
|
|
|
|
|
|
|
38
|
16
|
100
|
|
|
|
72
|
if (! $condition) |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
|
|
11
|
require Carp; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
7
|
my $msg = |
43
|
|
|
|
|
|
|
sprintf("Assert failed - '%s'!", $name) |
44
|
|
|
|
|
|
|
; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
414
|
Carp::croak($msg); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Originally written by: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Michael G Schwern C<< <schwern@pobox.com> >> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Rewritten as MIT-X11 Licensed code by: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Shlomi Fish L<http://www.shlomifish.org/> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 COPYRIGHT |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Copyright by Shlomi Fish, 2008. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 LICENSE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This file is licensed under the MIT X11 License: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<http://www.opensource.org/licenses/mit-license.php> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|