line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::BOM; |
2
|
|
|
|
|
|
|
$Test::BOM::VERSION = '0.001'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Test strings and files for BOM |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
71984
|
use strict; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
15
|
use base qw(Test::Builder::Module); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw(string_has_bom string_hasnt_bom file_has_bom file_hasnt_bom); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# We have subs of the same name, don't import them |
13
|
1
|
|
|
1
|
|
1056
|
use String::BOM qw(); |
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
236
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $CLASS = __PACKAGE__; |
16
|
|
|
|
|
|
|
my $Tester = $CLASS->builder; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub string_has_bom { |
19
|
6
|
|
|
6
|
1
|
13825
|
my ($string) = @_; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
15
|
my $ok = String::BOM::string_has_bom($string); |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
92
|
$Tester->ok( $ok, q{string has BOM} ); |
24
|
6
|
100
|
|
|
|
2342
|
unless ($ok) { |
25
|
1
|
|
|
|
|
10
|
$Tester->diag('String was expected to have a BOM but did not.'); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
156
|
return $ok; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub string_hasnt_bom { |
32
|
6
|
|
|
6
|
1
|
16859
|
my ($string) = @_; |
33
|
|
|
|
|
|
|
|
34
|
6
|
|
|
|
|
21
|
my $ok = String::BOM::string_has_bom($string); |
35
|
|
|
|
|
|
|
|
36
|
6
|
|
|
|
|
78
|
$Tester->ok( !$ok, q{string hasn't BOM} ); |
37
|
6
|
100
|
|
|
|
2247
|
if ($ok) { |
38
|
5
|
|
|
|
|
26
|
$Tester->diag('String was expected not to have a BOM but it has.'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
6
|
|
|
|
|
682
|
return !$ok; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub file_has_bom { |
45
|
6
|
|
|
6
|
1
|
40017
|
my ($string) = @_; |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
|
|
18
|
my $ok = String::BOM::file_has_bom($string); |
48
|
|
|
|
|
|
|
|
49
|
6
|
|
|
|
|
526
|
$Tester->ok( $ok, q{file has BOM} ); |
50
|
6
|
100
|
|
|
|
2540
|
unless ($ok) { |
51
|
1
|
|
|
|
|
10
|
$Tester->diag('File was expected to have a BOM but did not.'); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
6
|
|
|
|
|
159
|
return $ok; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub file_hasnt_bom { |
58
|
6
|
|
|
6
|
1
|
22318
|
my ($string) = @_; |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
18
|
my $ok = String::BOM::file_has_bom($string); |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
|
|
|
469
|
$Tester->ok( !$ok, q{file has BOM} ); |
63
|
6
|
100
|
|
|
|
2371
|
if ($ok) { |
64
|
5
|
|
|
|
|
25
|
$Tester->diag('File was expected to not have a BOM but it has.'); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
6
|
|
|
|
|
684
|
return !$ok; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |