X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/604d0391ba2d372f8de6efd364e9978fb11e4f92..c03b033969b22b4c540c5ca8ec7b730dda4bd483:/t/inline.t diff --git a/t/inline.t b/t/inline.t index 9bad525be..3a4450365 100755 --- a/t/inline.t +++ b/t/inline.t @@ -1,9 +1,28 @@ #!/usr/bin/perl use warnings; use strict; +use Cwd qw(getcwd); use Test::More; use IkiWiki; +my $installed = $ENV{INSTALLED_TESTS}; + +my @command; +if ($installed) { + @command = qw(ikiwiki); +} +else { + ok(! system("make -s ikiwiki.out")); + @command = ("perl", "-I".getcwd, qw(./ikiwiki.out + --underlaydir=underlays/basewiki + --set underlaydirbase=underlays + --templatedir=templates)); +} + +push @command, qw(--set usedirs=0 --plugin inline + --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi + --rss --atom t/tmp/in t/tmp/out --verbose); + my $blob; my $add_new_post = gettext("Add a new post titled:"); @@ -22,11 +41,15 @@ sub write_old_file { 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 @@ -34,14 +57,12 @@ foreach my $page (qw(protagonists/shepard protagonists/link 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("make -s ikiwiki.out")); - -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"; - -ok(! system($command)); - -ok(! system("$command --refresh")); +ok(! system(@command)); +ok(! system(@command, "--refresh")); $blob = readfile("t/tmp/out/protagonists.html"); like($blob, qr{\Q$add_new_post\E}, 'rootpage=yes gives postform'); @@ -55,7 +76,7 @@ like($blob, qr{