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
|
|
979
|
use FindBin; |
|
1
|
|
|
|
|
1307
|
|
|
1
|
|
|
|
|
59
|
|
6
|
1
|
|
|
1
|
|
866
|
use lib "$FindBin::Bin/../perllib"; |
|
1
|
|
|
|
|
744
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
|
|
4
|
my $diff_content = <
|
9
|
|
|
|
|
|
|
--- one.txt 2005-02-28 23:33:04.057016488 +0200 |
10
|
|
|
|
|
|
|
+++ two.txt 2005-02-28 23:33:54.655324376 +0200 |
11
|
|
|
|
|
|
|
@@ -2,9 +2,8 @@ |
12
|
|
|
|
|
|
|
222 |
13
|
|
|
|
|
|
|
333 |
14
|
|
|
|
|
|
|
444 |
15
|
|
|
|
|
|
|
-555 |
16
|
|
|
|
|
|
|
-666 |
17
|
|
|
|
|
|
|
+aaa |
18
|
|
|
|
|
|
|
777 |
19
|
|
|
|
|
|
|
+bbb |
20
|
|
|
|
|
|
|
888 |
21
|
|
|
|
|
|
|
-999 |
22
|
|
|
|
|
|
|
000 |
23
|
|
|
|
|
|
|
ENDTEXT |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
1411
|
use Test::More tests => 12; |
|
1
|
|
|
|
|
28818
|
|
|
1
|
|
|
|
|
13
|
|
26
|
1
|
|
|
1
|
|
8
|
use_ok("Arch::DiffParser"); |
|
1
|
|
|
|
|
815
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
407
|
my $parser = Arch::DiffParser->new; |
29
|
1
|
|
|
|
|
5
|
isa_ok($parser, Arch::DiffParser, "create object"); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
330
|
is($parser->parse($diff_content), $parser, "parse diff"); |
32
|
1
|
|
|
|
|
639
|
is(${$parser->diff_data}{filename1}, $parser->filename1, "diff_data"); |
|
1
|
|
|
|
|
9
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
294
|
is(scalar @{$parser->lines}, 14, "lines"); |
|
1
|
|
|
|
|
5
|
|
35
|
1
|
|
|
|
|
405
|
is($parser->filename1, "one.txt", "filename1"); |
36
|
1
|
|
|
|
|
295
|
is($parser->filename2, "two.txt", "filename2"); |
37
|
1
|
|
|
|
|
363
|
is($parser->mtime1, "2005-02-28 23:33:04.057016488 +0200", "mtime1"); |
38
|
1
|
|
|
|
|
273
|
is($parser->mtime2, "2005-02-28 23:33:54.655324376 +0200", "mtime2"); |
39
|
1
|
|
|
|
|
276
|
is($parser->content, $diff_content, "content"); |
40
|
1
|
|
|
|
|
371
|
is_deeply($parser->hunks, [ [ 2, 9, 2, 8, 2 ] ], "hunks"); |
41
|
1
|
|
|
|
|
1070
|
is_deeply($parser->changes, [ [ 5, 2, 5, 1, 6 ], [ 8, 0, 7, 1, 10 ], [ 9, 1, 9, 0, 12 ] ], "changes"); |