X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/773db5a35e5b81fee3f1f8bf48dffc1dd4f3e2fe..46eb10fcf6334d0ce138a48b70c74edb1d7a1132:/t/conflicts.t diff --git a/t/conflicts.t b/t/conflicts.t index 81b2c12cb..07c392cd3 100755 --- a/t/conflicts.t +++ b/t/conflicts.t @@ -2,17 +2,32 @@ # Tests for bugs relating to conflicting files in the srcdir use warnings; use strict; -use Test::More tests => 76; +use Test::More tests => 106; + +my $installed = $ENV{INSTALLED_TESTS}; + +my @command; +if ($installed) { + ok(1, "running installed"); + @command = qw(ikiwiki); +} +else { + ok(! system("make -s ikiwiki.out")); + @command = qw(perl -I. ./ikiwiki.out + --underlaydir=underlays/basewiki + --set underlaydirbase=underlays + --templatedir=templates); +} # setup my $srcdir="t/tmp/src"; my $destdir="t/tmp/dest"; -ok(! system("make -s ikiwiki.out")); # runs ikiwiki to build test site sub runiki { my $testdesc=shift; - ok((! system("perl -I. ./ikiwiki.out -plugin txt -plugin rawhtml -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates $srcdir $destdir @_")), + ok((! system(@command, qw(--plugin txt --plugin rawhtml), + $srcdir, $destdir, @_)), $testdesc); } sub refreshiki { @@ -64,6 +79,19 @@ setupiki("initial setup"); ok(! system("touch $srcdir/foo.mdwn")); refreshiki("conflicting non-page added (page already existing) in refresh"); +# Page that renders to a file that is also a subdirectory holding another +# file. +newsrcdir(); +ok(! system("touch $srcdir/foo.mdwn")); +ok(! system("mkdir -p $srcdir/foo/index.html")); +ok(! system("touch $srcdir/foo/index.html/bar.mdwn")); +setupiki("conflicting page file and subdirectory"); +newsrcdir(); +ok(! system("touch $srcdir/foo.mdwn")); +ok(! system("mkdir -p $srcdir/foo/index.html")); +ok(! system("touch $srcdir/foo/index.html/bar")); +setupiki("conflicting page file and subdirectory 2"); + # Changing a page file into a non-page could also cause ikiwiki to fail. newsrcdir(); ok(! system("touch $srcdir/foo.mdwn")); @@ -86,6 +114,13 @@ setupiki("initial setup"); ok(! system("mkdir -p $srcdir/foo")); ok(! system("touch $srcdir/foo/index.html")); refreshiki("rawhtml file rendered same as existing page in refresh"); +# Moved when refreshing +newsrcdir(); +ok(! system("touch $srcdir/foo.mdwn")); +setupiki("initial setup"); +ok(! system("mkdir -p $srcdir/foo")); +ok(! system("mv $srcdir/foo.mdwn $srcdir/foo/index.html")); +refreshiki("existing page moved to rawhtml file in refresh"); # Inverse added when refreshing newsrcdir(); ok(! system("mkdir -p $srcdir/foo")); @@ -93,6 +128,13 @@ ok(! system("touch $srcdir/foo/index.html")); setupiki("initial setup"); ok(! system("touch $srcdir/foo.mdwn")); refreshiki("page rendered same as existing rawhtml file in refresh"); +# Inverse moved when refreshing +newsrcdir(); +ok(! system("mkdir -p $srcdir/foo")); +ok(! system("touch $srcdir/foo/index.html")); +setupiki("initial setup"); +ok(! system("mv $srcdir/foo/index.html $srcdir/foo.mdwn")); +refreshiki("rawhtml file moved to page in refresh"); # Present during setup newsrcdir(); ok(! system("touch $srcdir/foo.mdwn"));