2 # Tests for bugs relating to conflicting files in the srcdir
5 use Test::More 'no_plan';
8 my $srcdir="t/tmp/src";
9 my $destdir="t/tmp/dest";
10 ok(! system("make -s ikiwiki.out"));
12 # runs ikiwiki to build test site
15 ok((! system("perl -I. ./ikiwiki.out -plugin txt -plugin rawhtml -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates $srcdir $destdir @_")),
22 ok(! system("rm -rf $srcdir/.ikiwiki $destdir"));
23 runiki(shift, "--rebuild");
26 ok(! system("rm -rf $srcdir $destdir"));
27 ok(! system("mkdir -p $srcdir"));
30 # At one point, changing the extension of the source file of a page caused
33 ok(! system("touch $srcdir/foo.mdwn"));
34 setupiki("initial setup");
35 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo.txt"));
36 refreshiki("changed extension of source file of page");
37 ok(! system("mv $srcdir/foo.txt $srcdir/foo.mdwn"));
38 refreshiki("changed extension of source file of page 2");
40 # Conflicting page sources is sorta undefined behavior,
41 # but should not crash ikiwiki.
42 # Added when refreshing
43 ok(! system("touch $srcdir/foo.txt"));
44 refreshiki("conflicting page sources in refresh");
45 # Present during setup
47 ok(! system("touch $srcdir/foo.mdwn"));
48 ok(! system("touch $srcdir/foo.txt"));
49 setupiki("conflicting page sources in setup");
51 # Changing a page file into a non-page could also cause ikiwiki to fail.
53 ok(! system("touch $srcdir/foo.mdwn"));
54 setupiki("initial setup");
55 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo"));
56 refreshiki("page file turned into non-page");
58 # Changing a non-page file into a page could also cause ikiwiki to fail.
60 ok(! system("touch $srcdir/foo"));
61 setupiki("initial setup");
62 ok(! system("mv $srcdir/foo $srcdir/foo.mdwn"));
63 refreshiki("non-page file turned into page");
65 # What if a page renders to the same html file that a rawhtml file provides?
66 # Added when refreshing
68 ok(! system("touch $srcdir/foo.mdwn"));
69 setupiki("initial setup");
70 ok(! system("mkdir -p $srcdir/foo"));
71 ok(! system("touch $srcdir/foo/index.html"));
72 refreshiki("rawhtml file rendered same as existing page in refresh");
73 # Present during setup
75 ok(! system("touch $srcdir/foo.mdwn"));
76 ok(! system("mkdir -p $srcdir/foo"));
77 ok(! system("touch $srcdir/foo/index.html"));
78 setupiki("rawhtml file rendered same as existing page in setup");
81 ok(! system("rm -rf t/tmp"));