aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2019-02-03 12:25:20 +0000
committerSimon McVittie <smcv@debian.org>2019-02-03 12:34:46 +0000
commit2bde54c9dc0e1776882f4e0fef5750296e848c5b (patch)
tree8f783bae015e5b27b38e79fcf28e4d0a458a71e3 /t
parent3fe5d0acbfcb42d8c3898672db8b9b5cb4f6cec8 (diff)
downloadikiwiki-2bde54c9dc0e1776882f4e0fef5750296e848c5b.tar
ikiwiki-2bde54c9dc0e1776882f4e0fef5750296e848c5b.tar.gz
t: Consistently remove temp directory before testing, not after
When a test fails, it's useful to be able to inspect the output. Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 't')
-rwxr-xr-xt/basewiki_brokenlinks.t1
-rwxr-xr-xt/conflicts.t5
-rwxr-xr-xt/find_src_files.t7
-rwxr-xr-xt/img.t3
-rwxr-xr-xt/libdirs.t4
-rwxr-xr-xt/map.t1
-rwxr-xr-xt/meta.t2
-rwxr-xr-xt/permalink.t3
-rwxr-xr-xt/podcast.t12
-rwxr-xr-xt/tag.t8
-rwxr-xr-xt/trail.t2
-rwxr-xr-xt/wrapper-environ.t2
12 files changed, 20 insertions, 30 deletions
diff --git a/t/basewiki_brokenlinks.t b/t/basewiki_brokenlinks.t
index f639d0dd8..6a86c4313 100755
--- a/t/basewiki_brokenlinks.t
+++ b/t/basewiki_brokenlinks.t
@@ -38,6 +38,5 @@ foreach my $plugin ("", "listdirectives") {
ok(-e "t/tmp/out/style.css"); # linked to..
ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
}
-ok(! system("rm -rf t/tmp"));
done_testing();
diff --git a/t/conflicts.t b/t/conflicts.t
index 2c2761efb..ef183c6b6 100755
--- a/t/conflicts.t
+++ b/t/conflicts.t
@@ -3,7 +3,7 @@
use warnings;
use strict;
use Cwd qw(getcwd);
-use Test::More tests => 106;
+use Test::More;
my $installed = $ENV{INSTALLED_TESTS};
@@ -143,5 +143,4 @@ ok(! system("mkdir -p $srcdir/foo"));
ok(! system("touch $srcdir/foo/index.html"));
setupiki("rawhtml file rendered same as existing page in setup");
-# cleanup
-ok(! system("rm -rf t/tmp"));
+done_testing;
diff --git a/t/find_src_files.t b/t/find_src_files.t
index a3742db75..9dbf6eafe 100755
--- a/t/find_src_files.t
+++ b/t/find_src_files.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 20;
+use Test::More;
BEGIN { use_ok("IkiWiki"); }
BEGIN { use_ok("IkiWiki::Render"); }
@@ -91,7 +91,4 @@ test_src_files(\@list, "deep dir symlink in srcdir skipped");
system("ln -sf /etc/ $config{underlaydir}/ikiwiki/symdir");
test_src_files(\@list, "deep dir symlink in underlaydir skipped");
-
-
-
-cleanup();
+done_testing;
diff --git a/t/img.t b/t/img.t
index 92cd61e13..d5479b96d 100755
--- a/t/img.t
+++ b/t/img.t
@@ -257,9 +257,6 @@ if (1) { # for easier testing
ok(! -e "$outpath/x8-hello:world.png");
ok(! -e "$outpath/x4-a:b:c.png");
ok(! -e "$outpath/x6-a:b:c:d:e:f:g:h:i:j.png");
-
- # cleanup
- ok(! system("rm -rf t/tmp"));
}
done_testing;
diff --git a/t/libdirs.t b/t/libdirs.t
index 906a54105..994ceb67d 100755
--- a/t/libdirs.t
+++ b/t/libdirs.t
@@ -6,6 +6,7 @@ use File::Path qw(make_path remove_tree);
BEGIN { use_ok("IkiWiki"); }
+remove_tree("t/tmp");
make_path("t/tmp/libdir");
make_path("t/tmp/libdirs");
make_path("t/tmp/libdirs/1");
@@ -36,7 +37,4 @@ ok(grep { m/^ext_plugin_in_libdir$/ } @plugins);
ok(grep { m/^ext_plugin_in_libdir_1$/ } @plugins);
ok(grep { m/^ext_plugin_in_libdir_2$/ } @plugins);
-remove_tree("t/tmp/libdir");
-remove_tree("t/tmp/libdirs");
-
done_testing;
diff --git a/t/map.t b/t/map.t
index 5d4713d6f..36210d808 100755
--- a/t/map.t
+++ b/t/map.t
@@ -236,7 +236,6 @@ check('alpha/1/i*',
node('iv', []),
]);
-ok(! system("rm -rf t/tmp"));
done_testing;
1;
diff --git a/t/meta.t b/t/meta.t
index 8602930bc..7f26a957b 100755
--- a/t/meta.t
+++ b/t/meta.t
@@ -28,11 +28,11 @@ 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(
diff --git a/t/permalink.t b/t/permalink.t
index 2eb557e1d..7b6b89bea 100755
--- a/t/permalink.t
+++ b/t/permalink.t
@@ -18,7 +18,7 @@ else {
--templatedir=templates));
}
-ok(! system("rm -rf t/tmp"));
+ok(! system("rm -rf t/tmp t/tinyblog/.ikiwiki"));
ok(! system("mkdir t/tmp"));
ok(! system(@command, qw(--plugin inline --url=http://example.com
--cgiurl=http://example.com/ikiwiki.cgi --rss --atom
@@ -27,6 +27,5 @@ ok(! system(@command, qw(--plugin inline --url=http://example.com
my $guid="http://example.com/post/";
ok(length `egrep '<guid.*>$guid</guid>' t/tmp/out/index.rss`);
ok(length `egrep '<id>$guid</id>' t/tmp/out/index.atom`);
-ok(! system("rm -rf t/tmp t/tinyblog/.ikiwiki"));
done_testing();
diff --git a/t/podcast.t b/t/podcast.t
index 708ac7640..7b0987e21 100755
--- a/t/podcast.t
+++ b/t/podcast.t
@@ -9,7 +9,7 @@ BEGIN {
"XML::Feed and/or HTML::Parser or File::MimeInfo not available"};
}
else {
- eval q{use Test::More tests => 137};
+ eval q{use Test::More};
}
}
@@ -41,6 +41,8 @@ sub podcast {
my @command = (@base_command, qw(--plugin inline --rss --atom));
push @command, "--url=$baseurl", qw(t/tinypodcast), "$tmp/out";
+ ok(! system("rm -rf $tmp $statedir"), q{setup});
+
ok(! system("mkdir $tmp"),
q{setup});
ok(! system(@command),
@@ -121,14 +123,14 @@ sub podcast {
}
}
}
-
- ok(! system("rm -rf $tmp $statedir"), q{teardown});
}
sub single_page_html {
my @command = @base_command;
push @command, qw(t/tinypodcast), "$tmp/out";
+ ok(! system("rm -rf $tmp $statedir"), q{setup});
+
ok(! system("mkdir $tmp"),
q{setup});
ok(! system(@command),
@@ -172,6 +174,8 @@ sub inlined_pages_html {
my @command = (@base_command, qw(--plugin inline));
push @command, qw(t/tinypodcast), "$tmp/out";
+ ok(! system("rm -rf $tmp $statedir"), q{setup});
+
ok(! system("mkdir $tmp"),
q{setup});
ok(! system(@command),
@@ -240,3 +244,5 @@ podcast('simple');
single_page_html();
inlined_pages_html();
podcast('fancy');
+
+done_testing;
diff --git a/t/tag.t b/t/tag.t
index cc0a30cad..5bee61f52 100755
--- a/t/tag.t
+++ b/t/tag.t
@@ -3,7 +3,7 @@ package IkiWiki;
use warnings;
use strict;
-use Test::More tests => 24;
+use Test::More;
BEGIN { use_ok("IkiWiki"); }
BEGIN { use_ok("IkiWiki::Render"); }
@@ -81,8 +81,4 @@ IkiWiki::gen_autofile("tags/primes.mdwn", \%pages, \@del);
is_deeply(\%pages, {});
is_deeply(\@del, ['tags/primes.mdwn']);
-
-# cleanup
-ok(! system("rm -rf t/tmp"));
-
-1;
+done_testing;
diff --git a/t/trail.t b/t/trail.t
index ed180d35c..a49a9e3bc 100755
--- a/t/trail.t
+++ b/t/trail.t
@@ -303,6 +303,4 @@ ok($blob =~ /\^ the new title \^/m);
check_no_trail("untrail/a.html");
check_no_trail("untrail/b.html");
-ok(! system("rm -rf t/tmp"));
-
done_testing();
diff --git a/t/wrapper-environ.t b/t/wrapper-environ.t
index d6d34b9d9..6254816fa 100755
--- a/t/wrapper-environ.t
+++ b/t/wrapper-environ.t
@@ -29,6 +29,8 @@ else {
--templatedir=templates));
}
+ok(! system("rm -rf t/tmp"));
+
writefile("test.setup", "t/tmp", <<EOF
# IkiWiki::Setup::Yaml - YAML formatted setup file
wikiname: this is the name of my wiki