File Coverage

t/02.syntax-simple.t
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 1     1   5 use strict;
  1         1  
  1         29  
4 1     1   3 use warnings;
  1         1  
  1         23  
5              
6 1     1   916 use Test::More qw(no_plan);
  1         17553  
  1         8  
7              
8 1     1   952 use lib qw(lib t/lib);
  1         568  
  1         5  
9 1     1   476 use IkiWiki q(2.0);
  0            
  0            
10              
11             use MyTestTools qw(:css);
12              
13             my $class = 'IkiWiki::Plugin::syntax::Simple';
14              
15             use_ok($class);
16              
17             my $engine = $class->new();
18              
19             isa_ok($engine, $class );
20              
21             my $source = <<'EOF';
22             /* This is a foo program */
23             int a = 3;
24             printf("%d\n",a);
25             EOF
26              
27             my $output = $engine->syntax_highlight( language => 'C',
28             source => $source,
29             linenumbers => 1,
30             bars => 1, );
31              
32             my $regex_ln = build_css_regex('synLineNumber','\d+');
33             like($output, $regex_ln, "Source text with line numbers");
34              
35             my $regex_bar = build_css_regex('synBar');
36             like($output, $regex_bar, "Source text with bar lines");
37              
38             check_results( $output,
39             synBar => 2,
40             synLineNumber => 3,
41             synType => 0,
42             synUnderlined => 0,
43             synComment => 0,
44             synConstant => 0, );
45