line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
941
|
use Test::More qw(no_plan); |
|
1
|
|
|
|
|
24885
|
|
|
1
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1081
|
use lib qw(lib t/lib); |
|
1
|
|
|
|
|
718
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
470
|
use IkiWiki q(2.0); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use MyTestTools qw(:css); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $class = 'IkiWiki::Plugin::syntax::Kate'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use_ok($class); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $engine = $class->new(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
SKIP: { |
20
|
|
|
|
|
|
|
skip "Syntax::Highlight::Engine::Kate not installed" if not $engine; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
isa_ok($engine, $class ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $source = <<'EOF'; |
25
|
|
|
|
|
|
|
/* This is a foo program */ |
26
|
|
|
|
|
|
|
int a = 3; |
27
|
|
|
|
|
|
|
printf("%d\n",a); |
28
|
|
|
|
|
|
|
EOF |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $output = eval { |
31
|
|
|
|
|
|
|
$engine->syntax_highlight( language => 'C', |
32
|
|
|
|
|
|
|
source => $source, |
33
|
|
|
|
|
|
|
linenumbers => 1, |
34
|
|
|
|
|
|
|
bars => 1, ); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if (Syntax::X::Engine::Use->caught()) { |
38
|
|
|
|
|
|
|
skip('Syntax::Highlight::Engine::Kate not installed'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $regex_ln = build_css_regex('synLineNumber','\d+'); |
42
|
|
|
|
|
|
|
like($output, $regex_ln, "Source text with line numbers"); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $regex_bar = build_css_regex('synBar'); |
45
|
|
|
|
|
|
|
like($output, $regex_bar, "Source text with bar lines"); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
check_results( $output, |
48
|
|
|
|
|
|
|
synBar => 2, |
49
|
|
|
|
|
|
|
synLineNumber => 3, |
50
|
|
|
|
|
|
|
synType => 1, |
51
|
|
|
|
|
|
|
synUnderlined => 1, |
52
|
|
|
|
|
|
|
synComment => 1, |
53
|
|
|
|
|
|
|
synConstant => 3, ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|