7 my $installed = $ENV{INSTALLED_TESTS};
11 @command = qw(ikiwiki);
14 ok(! system("make -s ikiwiki.out"));
15 @command = qw(perl -I. ./ikiwiki.out
16 --underlaydir=underlays/basewiki
17 --set underlaydirbase=underlays
18 --templatedir=templates);
21 push @command, qw(--set usedirs=0 --plugin inline
22 --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi
23 --rss --atom t/tmp/in t/tmp/out --verbose);
27 my $add_new_post = gettext("Add a new post titled:");
29 ok(! system("rm -rf t/tmp"));
30 ok(! system("mkdir t/tmp"));
36 writefile($name, "t/tmp/in", $content);
37 ok(utime(333333333, 333333333, "t/tmp/in/$name"));
40 write_old_file("protagonists.mdwn",
41 '[[!inline pages="protagonists/*" rootpage="protagonists/new"]]');
42 write_old_file("friends.mdwn",
43 '[[!inline pages="friends/*" postform=yes sort=title limit=2]]');
44 write_old_file("antagonists.mdwn",
45 '[[!inline pages="antagonists/*"]]');
46 # using old spelling of "limit" ("show") to verify backwards compat
47 write_old_file("enemies.mdwn",
48 '[[!inline pages="enemies/*" postform=no rootpage=enemies sort=title reverse=yes show=2]]');
49 foreach my $page (qw(protagonists/shepard protagonists/link
50 antagonists/saren antagonists/ganondorf
51 friends/garrus friends/liara friends/midna friends/telma
52 enemies/benezia enemies/geth enemies/rachni
54 write_old_file("$page.mdwn", "this page is {$page}");
57 ok(! system(@command));
58 ok(! system(@command, "--refresh"));
60 $blob = readfile("t/tmp/out/protagonists.html");
61 like($blob, qr{\Q$add_new_post\E}, 'rootpage=yes gives postform');
62 like($blob, qr{<input type="hidden" name="from" value="protagonists/new"},
63 'explicit rootpage is /protagonists/new');
65 $blob = readfile("t/tmp/out/friends.html");
66 like($blob, qr{\Q$add_new_post\E}, 'postform=yes forces postform');
67 like($blob, qr{<input type="hidden" name="from" value="friends"},
68 'implicit rootpage is /friends');
69 like($blob, qr[this page is \{friends/garrus}.*this page is \{friends/liara}]s,
70 'first two pages in desired sort order are present');
71 unlike($blob, qr{friends/(?:midna|telma)},
72 'pages excluded by limit should not be present');
74 $blob = readfile("t/tmp/out/antagonists.html");
75 unlike($blob, qr{\Q$add_new_post\E}, 'default is no postform');
77 $blob = readfile("t/tmp/out/enemies.html");
78 unlike($blob, qr{\Q$add_new_post\E}, 'postform=no forces no postform');
79 like($blob, qr[this page is \{enemies/zant}.*this page is \{enemies/rachni}]s,
80 'first two pages in reversed sort order are present');
81 unlike($blob, qr{enemies/(?:benezia|geth)},
82 'pages excluded by show should not be present');