8 ok(! system("rm -rf t/tmp"));
10 ok(! system("cp -R t/tinyblog t/tmp/in"));
11 ok(mkdir "t/tmp/in/post" or -d "t/tmp/in/post");
13 my $installed = $ENV{INSTALLED_TESTS};
17 @command = qw(ikiwiki);
20 ok(! system("make -s ikiwiki.out"));
21 @command = ("perl", "-I".getcwd, qw(./ikiwiki.out
22 --underlaydir=underlays/basewiki
23 --set underlaydirbase=underlays
24 --templatedir=templates));
30 [[!comment username="neil"
31 date="1969-07-20T20:17:40Z"
34 #ok(eval { writefile("post/comment_3._comment", "t/tmp/in", $comment); 1 });
35 writefile("post/comment_3._comment", "t/tmp/in", $comment);
38 [[!comment username="christopher"
39 date="1969-02-12T07:00:00Z"
40 content="I explored"]]
42 writefile("post/comment_2_10a49d69282155c5c3e66dc58f64f956._comment", "t/tmp/in", $comment);
45 [[!comment username="william"
46 date="1969-01-14T12:00:00Z"
47 content="I conquered"]]
49 writefile("post/comment_1._comment", "t/tmp/in", $comment);
51 # Give the files mtimes in the wrong order
52 ok(utime(111111111, 111111111, "t/tmp/in/post/comment_3._comment"));
53 ok(utime(222222222, 222222222, "t/tmp/in/post/comment_2_10a49d69282155c5c3e66dc58f64f956._comment"));
54 ok(utime(333333333, 333333333, "t/tmp/in/post/comment_1._comment"));
57 ok(! system(@command, qw(--verbose --plugin comments --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi --rss --atom --set comments_pagespec=* t/tmp/in t/tmp/out)));
59 # Check that the comments are in the right order
62 open my $fh, "<", shift or return undef;
65 close $fh or return undef;
69 my $content = slurp("t/tmp/out/post/index.html");
71 like($content, qr/I conquered.*I explored.*I landed/s);
73 $content = slurp("t/tmp/out/post/index.atom");
76 <link\s*href="http://example\.com/post/[#]comment-[[:xdigit:]]+"
78 <link\s*href="http://example\.com/post/[#]comment-[[:xdigit:]]+"
80 <link\s*href="http://example\.com/post/[#]comment-[[:xdigit:]]+"
81 }sx, 'Each comment gets an appropriate permalink in <link>');
82 unlike($content, qr{<link\s*href=.*/post/comment_[123]/});
83 unlike($content, qr{<link\s*href=.*/post/comment_[123]_[[:xdigit:]]+/});