2 # Tests for bugs relating to conflicting files in the srcdir
5 use Test::More tests => 92;
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 # Page and non-page file with same pagename.
53 ok(! system("touch $srcdir/foo.mdwn"));
54 ok(! system("touch $srcdir/foo"));
55 setupiki("conflicting page and non-page in setup");
57 ok(! system("touch $srcdir/foo.mdwn"));
58 setupiki("initial setup");
59 ok(! system("touch $srcdir/foo"));
60 refreshiki("conflicting page added (non-page already existing) in refresh");
62 ok(! system("touch $srcdir/foo"));
63 setupiki("initial setup");
64 ok(! system("touch $srcdir/foo.mdwn"));
65 refreshiki("conflicting non-page added (page already existing) in refresh");
67 # Changing a page file into a non-page could also cause ikiwiki to fail.
69 ok(! system("touch $srcdir/foo.mdwn"));
70 setupiki("initial setup");
71 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo"));
72 refreshiki("page file turned into non-page");
74 # Changing a non-page file into a page could also cause ikiwiki to fail.
76 ok(! system("touch $srcdir/foo"));
77 setupiki("initial setup");
78 ok(! system("mv $srcdir/foo $srcdir/foo.mdwn"));
79 refreshiki("non-page file turned into page");
81 # What if a page renders to the same html file that a rawhtml file provides?
82 # Added when refreshing
84 ok(! system("touch $srcdir/foo.mdwn"));
85 setupiki("initial setup");
86 ok(! system("mkdir -p $srcdir/foo"));
87 ok(! system("touch $srcdir/foo/index.html"));
88 refreshiki("rawhtml file rendered same as existing page in refresh");
89 # Moved when refreshing
91 ok(! system("touch $srcdir/foo.mdwn"));
92 setupiki("initial setup");
93 ok(! system("mkdir -p $srcdir/foo"));
94 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo/index.html"));
95 refreshiki("existing page moved to rawhtml file in refresh");
96 # Inverse added when refreshing
98 ok(! system("mkdir -p $srcdir/foo"));
99 ok(! system("touch $srcdir/foo/index.html"));
100 setupiki("initial setup");
101 ok(! system("touch $srcdir/foo.mdwn"));
102 refreshiki("page rendered same as existing rawhtml file in refresh");
103 # Inverse moved when refreshing
105 ok(! system("mkdir -p $srcdir/foo"));
106 ok(! system("touch $srcdir/foo/index.html"));
107 setupiki("initial setup");
108 ok(! system("mv $srcdir/foo/index.html $srcdir/foo.mdwn"));
109 refreshiki("rawhtml file moved to page in refresh");
110 # Present during setup
112 ok(! system("touch $srcdir/foo.mdwn"));
113 ok(! system("mkdir -p $srcdir/foo"));
114 ok(! system("touch $srcdir/foo/index.html"));
115 setupiki("rawhtml file rendered same as existing page in setup");
118 ok(! system("rm -rf t/tmp"));