line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The script tests Arch::FileHighlighter methods. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
736
|
use FindBin; |
|
1
|
|
|
|
|
1105
|
|
|
1
|
|
|
|
|
42
|
|
6
|
1
|
|
|
1
|
|
623
|
use lib "$FindBin::Bin/../perllib"; |
|
1
|
|
|
|
|
570
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
|
|
3
|
my $c_file_content = <
|
9
|
|
|
|
|
|
|
#include |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
/* useful program */ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
int main() { |
15
|
|
|
|
|
|
|
memfrob((void *)main, 100); |
16
|
|
|
|
|
|
|
return 0; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
/* end */ |
19
|
|
|
|
|
|
|
ENDTEXT |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
1135
|
use Test::More tests => 41; |
|
1
|
|
|
|
|
17439
|
|
|
1
|
|
|
|
|
8
|
|
22
|
1
|
|
|
1
|
|
5
|
use_ok("Arch::FileHighlighter"); |
|
1
|
|
|
|
|
712
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
994
|
my ($fh, $html_ref, @html_lines); |
25
|
0
|
|
|
|
|
0
|
my ($html_content, @ampersands, @tags); |
26
|
1
|
|
|
|
|
6
|
my @real_lines = Arch::Util::load_file($0) =~ /(.*)\n/g; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
4
|
|
68
|
sub comment ($) { qq() } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
16
|
$fh = Arch::FileHighlighter->new([ 'internal', 'none', 'enscript' ]); |
33
|
1
|
|
|
|
|
17
|
isa_ok($fh, 'Arch::FileHighlighter', "creating object 1"); |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
618
|
$html_ref = $fh->highlight($0); |
36
|
1
|
|
33
|
|
|
12
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight script itself"); |
37
|
1
|
|
|
|
|
680
|
@html_lines = $$html_ref =~ /(.*)\n/g; |
38
|
1
|
|
|
|
|
15
|
is(int @html_lines, int @real_lines, "number of markup lines"); |
39
|
1
|
|
|
|
|
580
|
is($html_lines[0], comment('#!/usr/bin/perl -w'), "markup of sh-bang line"); |
40
|
1
|
|
|
|
|
543
|
is($html_lines[1], '', "markup of empty line"); |
41
|
1
|
|
|
|
|
554
|
is($html_lines[2], comment('# The script tests Arch::FileHighlighter methods.'), "markup of comment line"); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
588
|
$html_ref = $fh->highlight("file.c", \$c_file_content); |
44
|
1
|
|
33
|
|
|
14
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight inline content"); |
45
|
1
|
|
|
|
|
1031
|
$html_content = $$html_ref; |
46
|
1
|
|
|
|
|
9
|
@ampersands = $html_content =~ /&/g; |
47
|
1
|
|
|
|
|
6
|
is(int @ampersands, 4, "entities/quoting"); |
48
|
1
|
|
|
|
|
711
|
@html_lines = $html_content =~ /(.*)\n/g; |
49
|
1
|
|
|
|
|
6
|
is(int @html_lines, 10, "number of lines"); |
50
|
1
|
|
|
|
|
533
|
@tags = $html_content =~ /
|
51
|
1
|
|
|
|
|
5
|
is(int @tags, 4, "number of tags"); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
844
|
$fh = Arch::FileHighlighter->new([ 'internal(c+pm)', 'none', 'enscript' ]); |
56
|
1
|
|
|
|
|
17
|
isa_ok($fh, 'Arch::FileHighlighter', "creating object 2"); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
820
|
$html_ref = $fh->highlight($0); |
59
|
1
|
|
33
|
|
|
12
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight script itself"); |
60
|
1
|
|
|
|
|
764
|
@html_lines = $$html_ref =~ /(.*)\n/g; |
61
|
1
|
|
|
|
|
16
|
is(int @html_lines, int @real_lines, "number of markup lines"); |
62
|
1
|
|
|
|
|
544
|
is($html_lines[0], '#!/usr/bin/perl -w', "markup of sh-bang line"); |
63
|
1
|
|
|
|
|
711
|
is($html_lines[1], '', "markup of empty line"); |
64
|
1
|
|
|
|
|
636
|
is($html_lines[2], '# The script tests Arch::FileHighlighter methods.', "markup of comment line"); |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
605
|
$html_ref = $fh->highlight("file.c", \$c_file_content); |
67
|
1
|
|
33
|
|
|
10
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight inline content"); |
68
|
1
|
|
|
|
|
546
|
$html_content = $$html_ref; |
69
|
1
|
|
|
|
|
9
|
@ampersands = $html_content =~ /&/g; |
70
|
1
|
|
|
|
|
4
|
is(int @ampersands, 4, "entities/quoting"); |
71
|
1
|
|
|
|
|
549
|
@html_lines = $html_content =~ /(.*)\n/g; |
72
|
1
|
|
|
|
|
14
|
is(int @html_lines, 10, "number of lines"); |
73
|
1
|
|
|
|
|
514
|
@tags = $html_content =~ /
|
74
|
1
|
|
|
|
|
6
|
is(int @tags, 4, "number of tags"); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
529
|
$fh = Arch::FileHighlighter->new([ 'none(c+pm)', 'internal', 'enscript' ]); |
79
|
1
|
|
|
|
|
7
|
isa_ok($fh, 'Arch::FileHighlighter', "creating object 3"); |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
6925
|
$html_ref = $fh->highlight($0); |
82
|
1
|
|
33
|
|
|
12
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight script itself"); |
83
|
1
|
|
|
|
|
874
|
@html_lines = $$html_ref =~ /(.*)\n/g; |
84
|
1
|
|
|
|
|
15
|
is(int @html_lines, int @real_lines, "number of markup lines"); |
85
|
1
|
|
|
|
|
530
|
is($html_lines[0], comment('#!/usr/bin/perl -w'), "markup of sh-bang line"); |
86
|
1
|
|
|
|
|
795
|
is($html_lines[1], '', "markup of empty line"); |
87
|
1
|
|
|
|
|
852
|
is($html_lines[2], comment('# The script tests Arch::FileHighlighter methods.'), "markup of comment line"); |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
622
|
$html_ref = $fh->highlight("file.c", \$c_file_content); |
90
|
1
|
|
33
|
|
|
14
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight inline content"); |
91
|
1
|
|
|
|
|
1202
|
$html_content = $$html_ref; |
92
|
1
|
|
|
|
|
11
|
@ampersands = $html_content =~ /&/g; |
93
|
1
|
|
|
|
|
6
|
is(int @ampersands, 4, "entities/quoting"); |
94
|
1
|
|
|
|
|
651
|
@html_lines = $html_content =~ /(.*)\n/g; |
95
|
1
|
|
|
|
|
5
|
is(int @html_lines, 10, "number of lines"); |
96
|
1
|
|
|
|
|
508
|
@tags = $html_content =~ /
|
97
|
1
|
|
|
|
|
6
|
is(int @tags, 0, "number of tags"); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
100
|
|
|
|
|
|
|
|
101
|
1
|
50
|
|
|
|
47
|
SKIP: { |
102
|
1
|
|
|
|
|
575
|
skip("no /usr/bin/enscript", 10) unless -x "/usr/bin/enscript"; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
0
|
$fh = Arch::FileHighlighter->new([ 'enscript(asis)', 'internal', 'none(c+pm)' ]); |
105
|
0
|
|
|
|
|
0
|
isa_ok($fh, 'Arch::FileHighlighter', "creating object 3"); |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
$html_ref = $fh->highlight($0); |
108
|
0
|
|
0
|
|
|
0
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight script itself"); |
109
|
0
|
|
|
|
|
0
|
@html_lines = $$html_ref =~ /(.*)\n/g; |
110
|
0
|
|
|
|
|
0
|
is(int @html_lines, int @real_lines, "number of markup lines"); |
111
|
0
|
|
|
|
|
0
|
is($html_lines[0], comment('#!/usr/bin/perl -w'), "markup of sh-bang line"); |
112
|
0
|
|
|
|
|
0
|
is($html_lines[1], '', "markup of empty line"); |
113
|
0
|
|
|
|
|
0
|
is($html_lines[2], comment('# The script tests Arch::FileHighlighter methods.'), "markup of comment line"); |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
0
|
$html_ref = $fh->highlight("file.c", \$c_file_content); |
116
|
0
|
|
0
|
|
|
0
|
ok($html_ref && ref($html_ref) eq 'SCALAR', "highlight inline content"); |
117
|
0
|
|
|
|
|
0
|
$html_content = $$html_ref; |
118
|
0
|
|
|
|
|
0
|
@ampersands = $html_content =~ /&/g; |
119
|
0
|
|
|
|
|
0
|
is(int @ampersands, 4, "entities/quoting"); |
120
|
0
|
|
|
|
|
0
|
@html_lines = $html_content =~ /(.*)\n/g; |
121
|
0
|
|
|
|
|
0
|
is(int @html_lines, 10, "number of lines"); |
122
|
0
|
|
|
|
|
0
|
@tags = $html_content =~ /
|
123
|
0
|
|
|
|
|
0
|
is(int @tags, 20, "number of tags"); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
} |