summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-07-17 13:24:40 -0400
committerJoey Hess <joey@kitenet.net>2010-07-17 13:24:40 -0400
commit41423084295f4b694cdb0ec208ea0a1807dc8a62 (patch)
tree2476b62a4a11e47a656a4bef53f2c14971d3d44c /t
parenta72193a81658e098fdafcd36b9bf20b4834d222e (diff)
turning into complete source file conflict test suite
Diffstat (limited to 't')
-rwxr-xr-xt/conflicts.t81
-rwxr-xr-xt/replace.t53
2 files changed, 81 insertions, 53 deletions
diff --git a/t/conflicts.t b/t/conflicts.t
new file mode 100755
index 000000000..7748c105f
--- /dev/null
+++ b/t/conflicts.t
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+# Tests for bugs relating to conflicting files in the srcdir
+use warnings;
+use strict;
+use Test::More 'no_plan';
+
+# 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 @_")),
+ $testdesc);
+}
+sub refreshiki {
+ runiki(shift);
+}
+sub setupiki {
+ ok(! system("rm -rf $srcdir/.ikiwiki $destdir"));
+ runiki(shift, "--rebuild");
+}
+sub newsrcdir {
+ ok(! system("rm -rf $srcdir $destdir"));
+ ok(! system("mkdir -p $srcdir"));
+}
+
+# At one point, changing the extension of the source file of a page caused
+# ikiwiki to fail.
+newsrcdir();
+ok(! system("touch $srcdir/foo.mdwn"));
+setupiki("initial setup");
+ok(! system("mv $srcdir/foo.mdwn $srcdir/foo.txt"));
+refreshiki("changed extension of source file of page");
+ok(! system("mv $srcdir/foo.txt $srcdir/foo.mdwn"));
+refreshiki("changed extension of source file of page 2");
+
+# Conflicting page sources is sorta undefined behavior,
+# but should not crash ikiwiki.
+# Added when refreshing
+ok(! system("touch $srcdir/foo.txt"));
+refreshiki("conflicting page sources in refresh");
+# Present during setup
+newsrcdir();
+ok(! system("touch $srcdir/foo.mdwn"));
+ok(! system("touch $srcdir/foo.txt"));
+setupiki("conflicting page sources in setup");
+
+# Changing a page file into a non-page could also cause ikiwiki to fail.
+newsrcdir();
+ok(! system("touch $srcdir/foo.mdwn"));
+setupiki("initial setup");
+ok(! system("mv $srcdir/foo.mdwn $srcdir/foo"));
+refreshiki("page file turned into non-page");
+
+# Changing a non-page file into a page could also cause ikiwiki to fail.
+newsrcdir();
+ok(! system("touch $srcdir/foo"));
+setupiki("initial setup");
+ok(! system("mv $srcdir/foo $srcdir/foo.mdwn"));
+refreshiki("non-page file turned into page");
+
+# What if a page renders to the same html file that a rawhtml file provides?
+# Added when refreshing
+newsrcdir();
+ok(! system("touch $srcdir/foo.mdwn"));
+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");
+# Present during setup
+newsrcdir();
+ok(! system("touch $srcdir/foo.mdwn"));
+ok(! system("mkdir -p $srcdir/foo"));
+ok(! system("touch $srcdir/foo/index.html"));
+setupiki("rawhtml file rendered same as existing page in setup");
+
+# cleanup
+ok(! system("rm -rf t/tmp"));
diff --git a/t/replace.t b/t/replace.t
deleted file mode 100755
index 04791d9f7..000000000
--- a/t/replace.t
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/perl
-# Tests for bugs relating to replacing/renaming files in the srcdir.
-use warnings;
-use strict;
-use Test::More 'no_plan';
-
-# 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 {
- ok(! system("perl -I. ./ikiwiki.out -plugin html -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates $srcdir $destdir @_"));
-}
-sub refreshiki {
- runiki();
-}
-sub setupiki {
- ok(! system("rm -rf $srcdir/.ikiwiki $destdir"));
- runiki("--rebuild");
-}
-sub newsrcdir {
- ok(! system("rm -rf $srcdir $destdir"));
- ok(! system("mkdir -p $srcdir"));
-}
-
-# At one point, changing the extension of the source file of a page caused
-# ikiwiki to fail.
-newsrcdir();
-ok(! system("touch $srcdir/foo.mdwn"));
-setupiki();
-ok(! system("mv $srcdir/foo.mdwn $srcdir/foo.html"));
-refreshiki();
-ok(! system("mv $srcdir/foo.html $srcdir/foo.mdwn"));
-refreshiki();
-
-# Changing a non-page file into a page could also cause ikiwiki to fail.
-newsrcdir();
-ok(! system("touch $srcdir/foo"));
-setupiki();
-ok(! system("mv $srcdir/foo $srcdir/foo.mdwn"));
-refreshiki();
-
-# Changing a page file into a non-page could also cause ikiwiki to fail.
-newsrcdir();
-ok(! system("touch $srcdir/foo.mdwn"));
-setupiki();
-ok(! system("mv $srcdir/foo.mdwn $srcdir/foo"));
-refreshiki();
-
-# cleanup
-ok(! system("rm -rf t/tmp"));