line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The script tests Arch::DiffParser methods. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
987
|
use FindBin; |
|
1
|
|
|
|
|
1407
|
|
|
1
|
|
|
|
|
57
|
|
6
|
1
|
|
|
1
|
|
1108
|
use lib "$FindBin::Bin/../perllib"; |
|
1
|
|
|
|
|
1108
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
|
|
4
|
my $diff_content = <
|
9
|
|
|
|
|
|
|
--- file one 1975-03-09 22:00:19 -0800 |
10
|
|
|
|
|
|
|
+++ file two 2005-03-09 22:00:27 -0800 |
11
|
|
|
|
|
|
|
@@ -1 +1,2 @@ |
12
|
|
|
|
|
|
|
-old line |
13
|
|
|
|
|
|
|
\\ No newline at end of file |
14
|
|
|
|
|
|
|
+new line |
15
|
|
|
|
|
|
|
+new line |
16
|
|
|
|
|
|
|
\\ No newline at end of file |
17
|
|
|
|
|
|
|
ENDTEXT |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
1757
|
use Test::More tests => 12; |
|
1
|
|
|
|
|
42247
|
|
|
1
|
|
|
|
|
14
|
|
20
|
1
|
|
|
1
|
|
7
|
use_ok("Arch::DiffParser"); |
|
1
|
|
|
|
|
808
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
399
|
my $parser = Arch::DiffParser->new; |
23
|
1
|
|
|
|
|
6
|
isa_ok($parser, Arch::DiffParser, "create object"); |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
342
|
is($parser->parse($diff_content), $parser, "parse diff"); |
26
|
1
|
|
|
|
|
256
|
is(${$parser->diff_data}{filename1}, $parser->filename1, "diff_data"); |
|
1
|
|
|
|
|
4
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
266
|
is(scalar @{$parser->lines}, 8, "lines"); |
|
1
|
|
|
|
|
4
|
|
29
|
1
|
|
|
|
|
391
|
is($parser->filename1, "file one", "filename1"); |
30
|
1
|
|
|
|
|
291
|
is($parser->filename2, "file two", "filename2"); |
31
|
1
|
|
|
|
|
333
|
is($parser->mtime1, "1975-03-09 22:00:19 -0800", "mtime1"); |
32
|
1
|
|
|
|
|
1217
|
is($parser->mtime2, "2005-03-09 22:00:27 -0800", "mtime2"); |
33
|
1
|
|
|
|
|
715
|
is($parser->content, $diff_content, "content"); |
34
|
1
|
|
|
|
|
696
|
is_deeply($parser->hunks, [ [ 1, 1, 1, 2, 2 ] ], "hunks"); |
35
|
1
|
|
|
|
|
1737
|
is_deeply($parser->changes, [ [ 1, 1, 1, 2, 3 ] ], "changes"); |