X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom.git;a=blobdiff_plain;f=t%2Fdriver;fp=t%2Fdriver;h=0000000000000000000000000000000000000000;hp=f176604cd5dc510170c8a23104469a4e904f33ee;hb=5f3663964d3883856fdd2699e5163a0cbc71e5c5;hpb=175a8afc17dc934e433967d7f3c6797a89a17424 diff --git a/t/driver b/t/driver deleted file mode 100644 index f176604..0000000 --- a/t/driver +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More qw( no_plan ); - -use Cwd; -use YAML; -use IO::File; -use File::Find; -use File::Copy; -#use File::Touch; -use File::Basename; -use Test::Differences; - -my $test = basename($0); -$test =~ s/^\d+_?//; -$test =~ s/\.t$//; - -my $testdir = $test; -$testdir = "t/$testdir" if -d "t/$testdir"; -$testdir = cwd . "/$testdir"; -die "cannot find root '$testdir'" unless -d $testdir; - -my $blosxom_config_dir = "$testdir/config"; -die "cannot find blosxom config dir '$blosxom_config_dir'" unless -d $blosxom_config_dir; -$ENV{BLOSXOM_CONFIG_DIR} = $blosxom_config_dir; - -my $blosxom_cgi = "$testdir/../../blosxom.cgi"; -die "cannot find blosxom.cgi '$blosxom_cgi'" unless -f $blosxom_cgi; -die "blosxom.cgi '$blosxom_cgi' is not executable" unless -x $blosxom_cgi; - -my $spec = YAML::LoadFile ("$testdir/spec.yaml") - or fail("$test - loading spec") and next; - -touch_files("$testdir/data"); - -my %expected = (); - -for (@{$spec->{tests}}) { - my ($args, $output) = @$_; - - unless ($expected{$output}) { - my $fh = IO::File->new("$testdir/$output", 'r') - or die "cannot open expected output file '$output': $!"; - { - local $/ = undef; - $expected{$output} = <$fh>; - } - $fh->close; - } - - my $got = qx($blosxom_cgi $args); - - eq_or_diff($got, $expected{$output}, "$test - got expected output for args [$args]", { style => 'Unified' }); -} - -sub touch_files { - find( sub { - if (/^(.*)\.(\d+)$/) { - copy($_, $1); - `touch -t $2 $1`; - } - }, - shift ); -}