map test: print maps' source as comments

master
Simon McVittie 2012-08-03 12:49:20 +01:00
parent 3f27a97336
commit 12ca01fd5c
1 changed files with 9 additions and 3 deletions

12
t/map.t
View File

@ -56,6 +56,12 @@ foreach my $page (@pages) {
writefile("$page.mdwn", "t/tmp", "your ad here");
}
sub comment {
my $str = shift;
$str =~ s/^/# /gm;
print $str;
}
sub node {
my $name = shift;
my $kids = shift;
@ -105,13 +111,14 @@ sub check_nodes {
sub check {
my $pagespec = shift;
my $expected = shift;
print "*** $pagespec ***\n";
comment("*** $pagespec ***\n");
my $html = IkiWiki::Plugin::map::preprocess(pages => $pagespec,
page => 'map',
destpage => 'map');
comment($html);
my $tree = XML::Twig->new(pretty_print => 'indented');
eval {
eval {
$tree->parse($html);
};
if ($@) {
@ -131,7 +138,6 @@ sub check {
}
$tree->dispose;
print "<!-- -->\n";
}
check('doesnotexist', []);