diff --git a/t/table.t b/t/table.t new file mode 100755 index 000000000..d7e9e6ff0 --- /dev/null +++ b/t/table.t @@ -0,0 +1,69 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Cwd qw(getcwd); +use Test::More; +use IkiWiki; + +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 table + --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi + t/tmp/in t/tmp/out --verbose); + +my $blob; + +ok(! system("rm -rf t/tmp")); +ok(! system("mkdir t/tmp")); + +sub write_old_file { + my $name = shift; + my $content = shift; + + writefile($name, "t/tmp/in", $content); + ok(utime(333333333, 333333333, "t/tmp/in/$name")); +} + +write_old_file("csv.mdwn", +'[[!table format="csv" data=""" +Key,Value +"ASCII","hello" +"Not ASCII","¬" +"""]]'); +write_old_file("dsv.mdwn", +'[[!table format="dsv" data=""" +Key | Value +ASCII | hello +Not ASCII | ¬ +"""]]'); + +ok(! system(@command)); +ok(! system(@command, "--refresh")); + +$blob = readfile("t/tmp/out/dsv.html"); +like($blob, qr{