blib/lib/Exception/Class/TCF/AssertFailure.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 10 | 10 | 100.0 |
branch | 1 | 2 | 50.0 |
condition | n/a | ||
subroutine | 3 | 3 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 15 | 16 | 93.7 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Exception::Class::TCF::AssertFailure; | ||||||
2 | require Exporter; | ||||||
3 | 1 | 1 | 1614 | use Exception::Class::TCF; | |||
1 | 1 | ||||||
1 | 180 | ||||||
4 | 1 | 1 | 5 | use vars qw(@ISA @EXPORT_OK); | |||
1 | 2 | ||||||
1 | 136 | ||||||
5 | |||||||
6 | @ISA = qw(Exception::Class::TCF::Error Exporter); | ||||||
7 | @EXPORT_OK = qw(&assert); | ||||||
8 | |||||||
9 | sub assert (&@) { | ||||||
10 | 2 | 2 | 1 | 11 | my $block = shift; | ||
11 | 2 | 50 | 4 | if ( not $block->() ) { | |||
12 | 2 | 20 | my $exc = Exception::Class::TCF::AssertFailure->new( @_ ); | ||||
13 | 2 | 7 | &Exception::Class::TCF::throw($exc); | ||||
14 | } | ||||||
15 | } | ||||||
16 | |||||||
17 |