X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/e0bfd0cafda6a44a826cdfe07b99299cc96dfdf3..9a99c4c6e2228954b27e1e93e2b66c12a74850ac:/t/trail.t diff --git a/t/trail.t b/t/trail.t index 28aa1c09d..dce3b3c7e 100755 --- a/t/trail.t +++ b/t/trail.t @@ -4,14 +4,42 @@ use strict; use Test::More 'no_plan'; use IkiWiki; +sub check_trail { + my $file=shift; + my $expected=shift; + my $trailname=shift || qr/\w+/; + my $blob=readfile("t/tmp/out/$file"); + my ($trailline)=$blob=~/^trail=$trailname\s+(.*)$/m; + is($trailline, $expected, "expected $expected in $file"); +} + +sub check_no_trail { + my $file=shift; + my $trailname=shift || qr/\w+/; + my $blob=readfile("t/tmp/out/$file"); + my ($trailline)=$blob=~/^trail=$trailname\s+(.*)$/m; + $trailline="" unless defined $trailline; + ok($trailline !~ /^trail=$trailname\s+/, "no trail $trailname in $file"); +} + my $blob; ok(! system("rm -rf t/tmp")); ok(! system("mkdir t/tmp")); +# Write files with a date in the past, so that when we refresh, +# the update is detected. +sub write_old_file { + my $name = shift; + my $content = shift; + + writefile($name, "t/tmp/in", $content); + ok(utime(333333333, 333333333, "t/tmp/in/$name")); +} + # Use a rather stylized template to override the default rendering, to make # it easy to search for the desired results -writefile("templates/trails.tmpl", "t/tmp/in", <