Add plugin_dir and plugin_list test cases.
[matthijs/upstream/blosxom.git] / t / 04_plugin_dir.t
1 # blosxom standard $plugin_dir testing
2
3 use strict;
4 use Test::More tests => 1;
5 use Test::Differences;
6 use Cwd;
7 use IO::File;
8
9 my $blosxom_root = 'plugin_dir';
10 $blosxom_root = "t/$blosxom_root" if -d "t/$blosxom_root";
11 $blosxom_root = cwd . "/$blosxom_root";
12 die "cannot find root '$blosxom_root'" 
13   unless -d $blosxom_root;
14
15 my $blosxom_config_dir = "$blosxom_root/config";
16 die "cannot find blosxom config dir '$blosxom_config_dir'" unless -d $blosxom_config_dir;
17 $ENV{BLOSXOM_CONFIG_DIR} = $blosxom_config_dir;
18
19 my $blosxom_cgi = "$blosxom_root/../../blosxom.cgi";
20 die "cannot find blosxom.cgi '$blosxom_cgi'" unless -f $blosxom_cgi;
21 die "blosxom.cgi '$blosxom_cgi' is not executable" unless -x $blosxom_cgi;
22
23 my $fh = IO::File->new("$blosxom_root/expected.html", 'r')
24   or die "cannot open expected output file '$blosxom_root/expected.html': $!";
25 my $expected;
26 {
27   local $/ = undef;
28   $expected = <$fh>;
29   $fh->close;
30 }
31
32 my $output = qx($blosxom_cgi);
33
34 eq_or_diff($output, $expected, 'html output ok');
35