line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::File::Cmp; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
132471
|
use 5.010; |
|
2
|
|
|
|
|
16
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
52
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use File::Spec; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Test::Builder; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
88
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
17
|
use Exporter 'import'; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
820
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(file_is); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $Test = Test::Builder->new; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub file_is($$;$) { |
21
|
5
|
|
|
5
|
1
|
11705
|
my ($got_f, $exp_f, $name) = (_resolve(shift), _resolve(shift), shift); |
22
|
5
|
|
66
|
|
|
28
|
$name //= "compare file '$got_f' with '$exp_f'"; |
23
|
5
|
|
|
|
|
7
|
my @got_lines = split(/\r?\n/, do { local (*ARGV, $/); @ARGV = ($got_f); <> }); |
|
5
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
483
|
|
24
|
5
|
|
|
|
|
17
|
my @exp_lines = split(/\r?\n/, do { local (*ARGV, $/); @ARGV = ($exp_f); <> }); |
|
5
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
313
|
|
25
|
5
|
100
|
|
|
|
24
|
if (@got_lines != @exp_lines) { |
26
|
1
|
|
|
|
|
5
|
$Test->ok(0, $name); |
27
|
1
|
|
|
|
|
951
|
$Test->diag(" Different number of lines"); |
28
|
1
|
|
|
|
|
225
|
return 0; |
29
|
|
|
|
|
|
|
} |
30
|
4
|
|
|
|
|
9
|
my $n = @got_lines; |
31
|
4
|
|
|
|
|
12
|
for (my $i = 0; $i < $n; ++$i) { |
32
|
10
|
|
|
|
|
23
|
my ($got, $exp) = ($got_lines[$i], $exp_lines[$i]); |
33
|
10
|
100
|
|
|
|
30
|
if ($got ne $exp) { |
34
|
1
|
|
|
|
|
6
|
$Test->ok(0, $name); |
35
|
1
|
|
|
|
|
1051
|
$Test->diag(" Files differ at line " . ($i + 1)); |
36
|
1
|
|
|
|
|
232
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
3
|
|
|
|
|
13
|
return $Test->ok(1, $name); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _resolve { |
44
|
10
|
50
|
|
10
|
|
130
|
$_[0] =~ m{/} ? File::Spec->catfile(split(m{/}, shift)) : shift; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; # End of Test::File::Cmp |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |