#!/usr/bin/perl
use warnings;
use strict;
+use Cwd qw(getcwd);
use Test::More;
use IkiWiki;
}
else {
ok(! system("make -s ikiwiki.out"));
- @command = qw(perl -I. ./ikiwiki.out
+ @command = ("perl", "-I".getcwd, qw(./ikiwiki.out
--underlaydir=underlays/basewiki
--set underlaydirbase=underlays
- --templatedir=templates);
+ --templatedir=templates));
}
push @command, qw(--set usedirs=0 --plugin inline
write_old_file("protagonists.mdwn",
'[[!inline pages="protagonists/*" rootpage="protagonists/new"]]');
write_old_file("friends.mdwn",
- '[[!inline pages="friends/*" postform=yes sort=title show=2]]');
+ '[[!inline pages="friends/*" postform=yes sort=title limit=2]]');
write_old_file("antagonists.mdwn",
'[[!inline pages="antagonists/*"]]');
+# using old spelling of "limit" ("show") to verify backwards compat
write_old_file("enemies.mdwn",
'[[!inline pages="enemies/*" postform=no rootpage=enemies sort=title reverse=yes show=2]]');
+# to test correct processing of ../
+write_old_file("blah/blah/enemies.mdwn",
+ '[[!inline pages="enemies/*" postform=no rootpage=enemies sort=title reverse=yes show=2]]');
foreach my $page (qw(protagonists/shepard protagonists/link
antagonists/saren antagonists/ganondorf
friends/garrus friends/liara friends/midna friends/telma
enemies/zant)) {
write_old_file("$page.mdwn", "this page is {$page}");
}
+# test cross-linking between pages as rendered in RSS
+write_old_file("enemies/zant.mdwn", "this page is {enemies/zant}\n\n".
+ "Zant hates [[friends/Midna]].");
ok(! system(@command));
ok(! system(@command, "--refresh"));
like($blob, qr[this page is \{friends/garrus}.*this page is \{friends/liara}]s,
'first two pages in desired sort order are present');
unlike($blob, qr{friends/(?:midna|telma)},
- 'pages excluded by show should not be present');
+ 'pages excluded by limit should not be present');
$blob = readfile("t/tmp/out/antagonists.html");
unlike($blob, qr{\Q$add_new_post\E}, 'default is no postform');
unlike($blob, qr{enemies/(?:benezia|geth)},
'pages excluded by show should not be present');
+$blob = readfile("t/tmp/out/enemies.rss");
+like($blob, qr[this page is \{enemies/zant}.*this page is \{enemies/rachni}]s,
+ 'first two pages in reversed sort order are present');
+like($blob,
+ qr[Zant hates <a href=(?:['"]|")http://example\.com/friends/midna.html(?:['"]|")>Midna</a>]s,
+ 'link is correctly relative');
+
+$blob = readfile("t/tmp/out/blah/blah/enemies.rss");
+like($blob, qr[this page is \{enemies/zant}.*this page is \{enemies/rachni}]s,
+ 'first two pages in reversed sort order are present');
+like($blob,
+ qr[Zant hates <a href=(?:['"]|")http://example\.com/friends/midna.html(?:['"]|")>Midna</a>]s,
+ 'link is correctly relative');
+
done_testing;