9 ok(! system("rm -rf t/tmp"));
10 ok(! system("mkdir t/tmp"));
16 writefile($name, "t/tmp/in", $content);
17 ok(utime(333333333, 333333333, "t/tmp/in/$name"));
20 write_old_file("protagonists.mdwn",
21 '[[!inline pages="protagonists/*" rootpage="protagonists/new"]]');
22 write_old_file("friends.mdwn",
23 '[[!inline pages="friends/*" postform=yes]]');
24 write_old_file("antagonists.mdwn",
25 '[[!inline pages="antagonists/*"]]');
26 write_old_file("enemies.mdwn",
27 '[[!inline pages="enemies/*" postform=no rootpage=enemies]]');
28 foreach my $page (qw(protagonists/shepard protagonists/link
29 antagonists/saren antagonists/ganondorf
30 friends/liara friends/midna
31 enemies/benezia enemies/zant)) {
32 write_old_file("$page.mdwn", "this page is *$page*");
35 ok(! system("make -s ikiwiki.out"));
37 my $command = "perl -I. ./ikiwiki.out -set usedirs=0 -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates t/tmp/in t/tmp/out -verbose";
39 ok(! system($command));
41 ok(! system("$command -refresh"));
43 $blob = readfile("t/tmp/out/protagonists.html");
44 like($blob, qr{Add a new post}, 'rootpage=yes gives postform');
45 like($blob, qr{<input type="hidden" name="from" value="protagonists/new"},
46 'explicit rootpage is /protagonists/new');
48 $blob = readfile("t/tmp/out/friends.html");
49 like($blob, qr{Add a new post}, 'postform=yes forces postform');
50 like($blob, qr{<input type="hidden" name="from" value="friends"},
51 'implicit rootpage is /friends');
53 $blob = readfile("t/tmp/out/antagonists.html");
54 unlike($blob, qr{Add a new post}, 'default is no postform');
56 $blob = readfile("t/tmp/out/enemies.html");
57 unlike($blob, qr{Add a new post}, 'postform=no forces no postform');