]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - t/trail.t
Added a comment: Could someone document the steps to achieve this?
[git.ikiwiki.info.git] / t / trail.t
index 59eb0d4d618e4a3096bb62ad5c505a6ce57fb671..ed180d35cd9820537afead9df25c00696a5cc83f 100755 (executable)
--- a/t/trail.t
+++ b/t/trail.t
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Cwd qw(getcwd);
+use Test::More;
 use IkiWiki;
 
 sub check_trail {
@@ -27,6 +28,24 @@ my $blob;
 ok(! system("rm -rf t/tmp"));
 ok(! system("mkdir t/tmp"));
 
+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 trail --plugin inline
+       --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi
+       --rss --atom t/tmp/in t/tmp/out --verbose);
+
 # Write files with a date in the past, so that when we refresh,
 # the update is detected.
 sub write_old_file {
@@ -129,13 +148,8 @@ write_old_file("wind_in_the_willows.mdwn", <<EOF
 EOF
 );
 
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out -set usedirs=0 -plugin trail -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/meme.html");
 ok($blob =~ /<a href="(\.\/)?badger.html">badger<\/a>/m);
@@ -232,7 +246,7 @@ writefile("limited/c.mdwn", "t/tmp/in", '[[!meta title="New C page"]]c');
 
 writefile("untrail.mdwn", "t/tmp/in", "no longer a trail");
 
-ok(! system("$command -refresh"));
+ok(! system(@command, "--refresh"));
 
 check_trail("add/a.html", "n=add/b p=");
 check_trail("add/b.html", "n=add/c p=add/a");
@@ -275,24 +289,20 @@ check_trail("limited/c.html", "n=limited/d p=limited/b");
 check_trail("limited/d.html", "n= p=limited/c");
 # Also, b and d should pick up the change to c. This regressed with the
 # change to using a presence dependency.
-TODO: {
-local $TODO = "trail members don't pick up other members' title changes";
 $blob = readfile("t/tmp/out/limited/b.html");
 ok($blob =~ /New C page &gt;/m);
 $blob = readfile("t/tmp/out/limited/d.html");
 ok($blob =~ /&lt; New C page/m);
-}
 
 # Members of a retitled trail should pick up that change.
 # This regressed with the change to using a presence dependency.
-TODO: {
-local $TODO = "trail members don't pick up the trail's title changes";
 $blob = readfile("t/tmp/out/retitled/a.html");
 ok($blob =~ /\^ the new title \^/m);
-}
 
 # untrail is no longer a trail, so these are no longer in it.
 check_no_trail("untrail/a.html");
 check_no_trail("untrail/b.html");
 
 ok(! system("rm -rf t/tmp"));
+
+done_testing();