6 use Test::More qw( no_plan );
15 use Test::Differences;
17 my $test = basename($0);
22 $testdir = "t/$testdir" if -d "t/$testdir";
23 $testdir = cwd . "/$testdir";
24 die "cannot find root '$testdir'" unless -d $testdir;
26 my $blosxom_config_dir = "$testdir/config";
27 die "cannot find blosxom config dir '$blosxom_config_dir'" unless -d $blosxom_config_dir;
28 $ENV{BLOSXOM_CONFIG_DIR} = $blosxom_config_dir;
30 my $blosxom_cgi = "$testdir/../../blosxom.cgi";
31 die "cannot find blosxom.cgi '$blosxom_cgi'" unless -f $blosxom_cgi;
32 die "blosxom.cgi '$blosxom_cgi' is not executable" unless -x $blosxom_cgi;
34 my $spec = YAML::LoadFile ("$testdir/spec.yaml")
35 or fail("$test - loading spec") and next;
37 touch_files("$testdir/data");
41 for (@{$spec->{tests}}) {
42 my ($args, $output) = @$_;
44 unless ($expected{$output}) {
45 my $fh = IO::File->new("$testdir/$output", 'r')
46 or die "cannot open expected output file '$output': $!";
49 $expected{$output} = <$fh>;
54 my $got = qx($blosxom_cgi $args);
56 eq_or_diff($got, $expected{$output}, "$test - got expected output for args [$args]", { style => 'Unified' });
61 if (/^(.*)\.(\d+)$/) {