]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - t/trail.t
document that checkcontent behaves differently for comments
[git.ikiwiki.info.git] / t / trail.t
index 59eb0d4d618e4a3096bb62ad5c505a6ce57fb671..125749f450178e6414d3bfef3f4ada893b4bcf94 100755 (executable)
--- a/t/trail.t
+++ b/t/trail.t
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More 'no_plan';
+use Cwd qw(getcwd);
+use Test::More;
 use IkiWiki;
 
 sub check_trail {
 use IkiWiki;
 
 sub check_trail {
@@ -27,6 +28,24 @@ my $blob;
 ok(! system("rm -rf t/tmp"));
 ok(! system("mkdir t/tmp"));
 
 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 {
 # Write files with a date in the past, so that when we refresh,
 # the update is detected.
 sub write_old_file {
@@ -83,6 +102,12 @@ write_old_file("sorting/end.mdwn", "end");
 write_old_file("sorting/new.mdwn", "new");
 write_old_file("sorting/old.mdwn", "old");
 write_old_file("sorting/ancient.mdwn", "ancient");
 write_old_file("sorting/new.mdwn", "new");
 write_old_file("sorting/old.mdwn", "old");
 write_old_file("sorting/ancient.mdwn", "ancient");
+write_old_file("unicode.mdwn", "[[!trailitems pagenames=\"unicode/\xAC unicode/\x{04D2} unicode/\x{2260} unicode/\x{0001F4A9}\"]]");
+write_old_file("unicode2.mdwn", "[[!trailitems pagenames=\"unicode/__172__ unicode/\x{04D2} unicode/__8800__ unicode/__128169__\"]]");
+write_old_file("unicode/__172__.mdwn", "trail item '\xAC'");
+write_old_file("unicode/\x{04D2}.mdwn", "trail item '\x{04D2}'");
+write_old_file("unicode/__8800__.mdwn", "trail item '\x{2260}'");
+write_old_file("unicode/__128169__.mdwn", "trail item '\x{0001F4A9}'");
 # These three need to be in the appropriate age order
 ok(utime(333333333, 333333333, "t/tmp/in/sorting/new.mdwn"));
 ok(utime(222222222, 222222222, "t/tmp/in/sorting/old.mdwn"));
 # These three need to be in the appropriate age order
 ok(utime(333333333, 333333333, "t/tmp/in/sorting/new.mdwn"));
 ok(utime(222222222, 222222222, "t/tmp/in/sorting/old.mdwn"));
@@ -129,13 +154,8 @@ write_old_file("wind_in_the_willows.mdwn", <<EOF
 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);
 
 $blob = readfile("t/tmp/out/meme.html");
 ok($blob =~ /<a href="(\.\/)?badger.html">badger<\/a>/m);
@@ -166,6 +186,16 @@ check_no_trail("snake.html", "wind_in_the_willows");
 
 check_trail("self_referential.html", "n= p=", "self_referential");
 
 
 check_trail("self_referential.html", "n= p=", "self_referential");
 
+check_trail("unicode/__172__.html", "n=unicode/\x{04D2} p=", "unicode");
+check_trail("unicode/\x{04D2}.html", "n=unicode/__8800__ p=unicode/__172__", "unicode");
+check_trail("unicode/__8800__.html", "n=unicode/__128169__ p=unicode/\x{04D2}", "unicode");
+check_trail("unicode/__128169__.html", "n= p=unicode/__8800__", "unicode");
+
+check_trail("unicode/__172__.html", "n=unicode/\x{04D2} p=", "unicode2");
+check_trail("unicode/\x{04D2}.html", "n=unicode/__8800__ p=unicode/__172__", "unicode2");
+check_trail("unicode/__8800__.html", "n=unicode/__128169__ p=unicode/\x{04D2}", "unicode2");
+check_trail("unicode/__128169__.html", "n= p=unicode/__8800__", "unicode2");
+
 check_trail("add/b.html", "n=add/d p=", "add");
 check_trail("add/d.html", "n= p=add/b", "add");
 ok(! -f "t/tmp/out/add/a.html");
 check_trail("add/b.html", "n=add/d p=", "add");
 check_trail("add/d.html", "n= p=add/b", "add");
 ok(! -f "t/tmp/out/add/a.html");
@@ -232,7 +262,7 @@ writefile("limited/c.mdwn", "t/tmp/in", '[[!meta title="New C page"]]c');
 
 writefile("untrail.mdwn", "t/tmp/in", "no longer a trail");
 
 
 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");
 
 check_trail("add/a.html", "n=add/b p=");
 check_trail("add/b.html", "n=add/c p=add/a");
@@ -275,24 +305,18 @@ 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.
 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);
 $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.
 
 # 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);
 $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");
 
 
 # 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();