line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::An; |
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
50
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
51
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
150
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/assert_an/; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
105
|
|
10
|
2
|
|
|
2
|
|
373
|
use Test::Chai::Util::Type qw/is_type/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
418
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub assert_an { |
13
|
106
|
|
|
106
|
0
|
170
|
my ($self, $type, $msg) = @_; |
14
|
|
|
|
|
|
|
|
15
|
106
|
50
|
|
|
|
248
|
flag($self, 'message', $msg) if defined $msg; |
16
|
|
|
|
|
|
|
|
17
|
106
|
|
|
|
|
242
|
my $obj = flag($self, 'object'); |
18
|
106
|
100
|
|
|
|
384
|
my $article = $type =~ /^[aeiou]/i ? 'an ' : 'a '; |
19
|
|
|
|
|
|
|
|
20
|
106
|
100
|
|
|
|
291
|
return $self->assert( |
21
|
|
|
|
|
|
|
is_type($obj, $type), |
22
|
|
|
|
|
|
|
'expected #{this} to be ' . $article . $type, |
23
|
|
|
|
|
|
|
'expected #{this} not to be ' . $article . $type |
24
|
|
|
|
|
|
|
) ? undef : 0; |
25
|
|
|
|
|
|
|
} |