File Coverage

t/06.info.t
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 1     1   8 use strict;
  1         1  
  1         49  
4 1     1   5 use warnings;
  1         2  
  1         35  
5              
6 1     1   1321 use Test::More;
  1         24592  
  1         11  
7 1     1   1451 use IO::File;
  1         12029  
  1         193  
8              
9 1     1   925 use lib qw(lib t/lib);
  1         703  
  1         6  
10 1     1   598 use IkiWiki q(2.0);
  0            
  0            
11             use MyTestTools qw(:all);
12              
13             my @engines = MyTestTools::Engines();
14              
15             # open the output example file
16             my $file = "examples/plugin-info.html";
17             if (not ResultsFile($file)) {
18             plan( skip_all => "Could not write to the ${file} file" );
19             }
20             else {
21             plan( tests => (scalar @engines + 1));
22             }
23              
24             use_ok("IkiWiki::Plugin::syntax");
25              
26             my $info_header = <
27            
28             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
29            
30            
31             Information about the backends
32            
43            
44            
45             EOF
46             my $info_footer = <
47            
48            
49             EOF
50              
51             my $info_fh = ResultsFile();
52             $info_fh->print($info_header);
53              
54             ENGINES:
55             foreach my $engine (@engines) {
56             $IkiWiki::config{syntax_engine} = $engine;
57              
58             eval {
59             IkiWiki::Plugin::syntax::checkconfig();
60             };
61              
62             if ($@) {
63             fail "load the plugin ${engine}";
64             next ENGINES;
65             }
66              
67             # call the preprocess function without parameters to obtain the
68             # HTML information
69             my $plugin_info = eval {
70             IkiWiki::Plugin::syntax::preprocess();
71             };
72              
73             if ($@) {
74             fail ("extended information about ${engine} - ${@}");
75             next ENGINES;
76             }
77             else {
78             $info_fh->print($plugin_info);
79             pass ("extended information about ${engine}");
80             }
81             }
82              
83             $info_fh->print($info_footer);
84             $info_fh->close();
85              
86