po: Improve test coverage
[ikiwiki] / t / permalink.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Cwd qw(getcwd);
5 use Test::More;
6
7 my $installed = $ENV{INSTALLED_TESTS};
8
9 my @command;
10 if ($installed) {
11         @command = qw(ikiwiki);
12 }
13 else {
14         ok(! system("make -s ikiwiki.out"));
15         @command = ("perl", "-I".getcwd, qw(./ikiwiki.out
16                 --underlaydir=underlays/basewiki
17                 --set underlaydirbase=underlays
18                 --templatedir=templates));
19 }
20
21 ok(! system("rm -rf t/tmp"));
22 ok(! system("mkdir t/tmp"));
23 ok(! system(@command, qw(--plugin inline --url=http://example.com
24                 --cgiurl=http://example.com/ikiwiki.cgi --rss --atom
25                 t/tinyblog t/tmp/out)));
26 # This guid should never, ever change, for any reason whatsoever!
27 my $guid="http://example.com/post/";
28 ok(length `egrep '<guid.*>$guid</guid>' t/tmp/out/index.rss`);
29 ok(length `egrep '<id>$guid</id>' t/tmp/out/index.atom`);
30 ok(! system("rm -rf t/tmp t/tinyblog/.ikiwiki"));
31
32 done_testing();