Photos
Blog
Projects
vanrenterghem.biz
projects
/
git.ikiwiki.info.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[git.ikiwiki.info.git]
/
t
/
map.t
diff --git
a/t/map.t
b/t/map.t
index 4c8e5ede655aa69756c1873219d1d6fe34484069..5d4713d6fc9604d91018280c253911082d75c212 100755
(executable)
--- a/
t/map.t
+++ b/
t/map.t
@@
-3,9
+3,16
@@
package IkiWiki;
use warnings;
use strict;
use warnings;
use strict;
-use XML::Twig;
use Test::More;
use Test::More;
+BEGIN {
+ unless (eval { require XML::Twig }) {
+ eval q{
+ use Test::More skip_all => "XML::Twig is not available"
+ }
+ }
+}
+
BEGIN { use_ok("IkiWiki"); }
BEGIN { use_ok("IkiWiki::Render"); }
BEGIN { use_ok("IkiWiki::Plugin::map"); }
BEGIN { use_ok("IkiWiki"); }
BEGIN { use_ok("IkiWiki::Render"); }
BEGIN { use_ok("IkiWiki::Plugin::map"); }
@@
-56,6
+63,12
@@
foreach my $page (@pages) {
writefile("$page.mdwn", "t/tmp", "your ad here");
}
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;
sub node {
my $name = shift;
my $kids = shift;
@@
-105,13
+118,14
@@
sub check_nodes {
sub check {
my $pagespec = shift;
my $expected = shift;
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');
my $html = IkiWiki::Plugin::map::preprocess(pages => $pagespec,
page => 'map',
destpage => 'map');
+ comment($html);
my $tree = XML::Twig->new(pretty_print => 'indented');
my $tree = XML::Twig->new(pretty_print => 'indented');
- eval {
+ eval {
$tree->parse($html);
};
if ($@) {
$tree->parse($html);
};
if ($@) {
@@
-131,7
+145,6
@@
sub check {
}
$tree->dispose;
}
$tree->dispose;
- print "<!-- -->\n";
}
check('doesnotexist', []);
}
check('doesnotexist', []);
@@
-223,6
+236,7
@@
check('alpha/1/i*',
node('iv', []),
]);
node('iv', []),
]);
+ok(! system("rm -rf t/tmp"));
done_testing;
1;
done_testing;
1;