2 # Tests for bugs relating to conflicting files in the srcdir
5 use Test::More tests => 106;
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 # Page that renders to a file that is also a subdirectory holding another
70 ok(! system("touch $srcdir/foo.mdwn"));
71 ok(! system("mkdir -p $srcdir/foo/index.html"));
72 ok(! system("touch $srcdir/foo/index.html/bar.mdwn"));
73 setupiki("conflicting page file and subdirectory");
75 ok(! system("touch $srcdir/foo.mdwn"));
76 ok(! system("mkdir -p $srcdir/foo/index.html"));
77 ok(! system("touch $srcdir/foo/index.html/bar"));
78 setupiki("conflicting page file and subdirectory 2");
80 # Changing a page file into a non-page could also cause ikiwiki to fail.
82 ok(! system("touch $srcdir/foo.mdwn"));
83 setupiki("initial setup");
84 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo"));
85 refreshiki("page file turned into non-page");
87 # Changing a non-page file into a page could also cause ikiwiki to fail.
89 ok(! system("touch $srcdir/foo"));
90 setupiki("initial setup");
91 ok(! system("mv $srcdir/foo $srcdir/foo.mdwn"));
92 refreshiki("non-page file turned into page");
94 # What if a page renders to the same html file that a rawhtml file provides?
95 # Added when refreshing
97 ok(! system("touch $srcdir/foo.mdwn"));
98 setupiki("initial setup");
99 ok(! system("mkdir -p $srcdir/foo"));
100 ok(! system("touch $srcdir/foo/index.html"));
101 refreshiki("rawhtml file rendered same as existing page in refresh");
102 # Moved when refreshing
104 ok(! system("touch $srcdir/foo.mdwn"));
105 setupiki("initial setup");
106 ok(! system("mkdir -p $srcdir/foo"));
107 ok(! system("mv $srcdir/foo.mdwn $srcdir/foo/index.html"));
108 refreshiki("existing page moved to rawhtml file in refresh");
109 # Inverse added when refreshing
111 ok(! system("mkdir -p $srcdir/foo"));
112 ok(! system("touch $srcdir/foo/index.html"));
113 setupiki("initial setup");
114 ok(! system("touch $srcdir/foo.mdwn"));
115 refreshiki("page rendered same as existing rawhtml file in refresh");
116 # Inverse moved when refreshing
118 ok(! system("mkdir -p $srcdir/foo"));
119 ok(! system("touch $srcdir/foo/index.html"));
120 setupiki("initial setup");
121 ok(! system("mv $srcdir/foo/index.html $srcdir/foo.mdwn"));
122 refreshiki("rawhtml file moved to page in refresh");
123 # Present during setup
125 ok(! system("touch $srcdir/foo.mdwn"));
126 ok(! system("mkdir -p $srcdir/foo"));
127 ok(! system("touch $srcdir/foo/index.html"));
128 setupiki("rawhtml file rendered same as existing page in setup");
131 ok(! system("rm -rf t/tmp"));