X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/7f76e0ccc1136afbd931c9ca97d2ef07c35be979..fc36ba4c1f80d37161967021b7ded6cc7e54819c:/t/meta.t
diff --git a/t/meta.t b/t/meta.t
index ab25c2f83..7f26a957b 100755
--- a/t/meta.t
+++ b/t/meta.t
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
+use Cwd qw(getcwd);
use Test::More;
use IkiWiki;
@@ -8,19 +9,30 @@ my $tmp = 't/tmp';
my $srcdir = "$tmp/in";
my $destdir = "$tmp/out";
-my @command = (qw(./ikiwiki.out --plugin meta --disable-plugin htmlscrubber));
-push @command, qw(-underlaydir=underlays/basewiki);
-push @command, qw(-set underlaydirbase=underlays);
-push @command, qw(--templatedir=templates);
+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(--plugin meta --disable-plugin htmlscrubber);
push @command, $srcdir, $destdir;
sub write_build_read_compare {
my ($pagename, $input, $expected_output) = @_;
+ ok(! system("rm -rf $tmp"), q{setup});
ok(! system("mkdir -p $srcdir"), q{setup});
writefile("$pagename.mdwn", $srcdir, $input);
ok(! system(@command), q{build});
like(readfile("$destdir/$pagename/index.html"), $expected_output);
- ok(! system("rm -rf $tmp"), q{teardown});
}
write_build_read_compare(
@@ -53,12 +65,6 @@ write_build_read_compare(
qr{
},
);
-write_build_read_compare(
- 'enclosure',
- q{[[!meta enclosure="ikiwiki/login-selector/wordpress.png"]]},
- qr{},
-);
-
write_build_read_compare(
'author',
q{[[!meta author="Noodly J. Appendage"]]},
@@ -79,14 +85,14 @@ write_build_read_compare(
write_build_read_compare(
'date',
- q{[[!meta date="12345"]]},
- qr{},
+ q{[[!meta date="2000-01-23"]]},
+ qr{},
);
write_build_read_compare(
'updated',
- q{[[!meta updated="12345"]]},
- qr{},
+ q{[[!meta updated="2018-03-21"]]},
+ qr{},
);
#write_build_read_compare(
@@ -125,12 +131,11 @@ write_build_read_compare(
# qr{},
#);
-# XXX buggy? is this my bug? maybe twitter:foo would just work if this worked
-#write_build_read_compare(
-# 'name',
-# q{[[!meta name="thingy" value1="hi" value2="hello"]]},
-# qr{},
-#);
+write_build_read_compare(
+ 'name',
+ q{[[!meta name="thingy" value1="hi" value2="hello"]]},
+ qr{},
+);
write_build_read_compare(
'keywords',
@@ -149,11 +154,23 @@ write_build_read_compare(
# '[[!meta twitter:card="player"]]',
# qr{},
#);
-#
-#write_build_read_compare(
-# 'twittercard2',
-# '[[!meta name="twitter:card" content="player"]]',
-# qr{},
-#);
+
+write_build_read_compare(
+ 'twittercard2',
+ '[[!meta name="twitter:card" content="player"]]',
+ qr{},
+);
+
+write_build_read_compare(
+ 'malformed_ISO-8601',
+ '[[!meta date="2018-02-281T12:00:00-0500"]]',
+ qr{Error: cannot parse date/time: 2018-02-281T12:00:00-0500},
+);
+
+write_build_read_compare(
+ 'nonsense_month',
+ '[[!meta date="2018-14-22T14:22:45-0500"]]',
+ qr{Error: cannot parse date/time: 2018-14-22T14:22:45-0500},
+);
done_testing();