aboutsummaryrefslogtreecommitdiff
path: root/t/cvs.t
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2012-01-21 20:54:26 -0500
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2012-01-22 10:44:49 -0500
commit3497f49f354d94eca2f1f4242e75a21ee1f51341 (patch)
treef90b139857cf777bc86b32797f9bb13f94c10c9b /t/cvs.t
parent0b7d5aeeb692089858202bac34664f15349eeb94 (diff)
downloadikiwiki-3497f49f354d94eca2f1f4242e75a21ee1f51341.tar
ikiwiki-3497f49f354d94eca2f1f4242e75a21ee1f51341.tar.gz
Fix regression: failing to make the temp dir should nix the test plan.
While here, nitpick style and wrap long lines.
Diffstat (limited to 't/cvs.t')
-rwxr-xr-xt/cvs.t30
1 files changed, 14 insertions, 16 deletions
diff --git a/t/cvs.t b/t/cvs.t
index 8b5bbb568..b216a88d6 100755
--- a/t/cvs.t
+++ b/t/cvs.t
@@ -8,23 +8,26 @@ my %ideal_test_plan = (tests => 8);
my $dir;
sub _determine_test_plan {
- my $cvs=`which cvs`; chomp $cvs;
- my $cvsps=`which cvsps`; chomp $cvsps;
+ my $cvs = `which cvs`; chomp $cvs;
+ my $cvsps = `which cvsps`; chomp $cvsps;
return (skip_all => 'cvs or cvsps not available')
unless -x $cvs && -x $cvsps;
- foreach my $module ('File::ReadBackwards', 'File::MimeInfo') {
+ foreach my $module (qw(File::ReadBackwards File::MimeInfo)) {
eval qq{use $module};
if ($@) {
return (skip_all => "$module not available");
}
}
+ $dir = "/tmp/ikiwiki-test-cvs.$$";
+ return (skip_all => "can't create $dir: $!")
+ unless mkdir($dir);
+
return %ideal_test_plan;
}
sub _startup {
- _mktempdir();
_generate_minimal_config();
_create_test_repo();
}
@@ -33,15 +36,8 @@ sub _shutdown {
system "rm -rf $dir";
}
-sub _mktempdir {
- $dir="/tmp/ikiwiki-test-cvs.$$";
- if (! mkdir($dir)) {
- die $@;
- }
-}
-
sub _generate_minimal_config {
- %config=IkiWiki::defaultconfig();
+ %config = IkiWiki::defaultconfig();
$config{rcs} = "cvs";
$config{srcdir} = "$dir/src";
$config{cvsrepo} = "$dir/repo";
@@ -62,9 +58,9 @@ sub _create_test_repo {
}
sub test_web_add_and_commit {
+ my $message = "Added the first page";
writefile('test1.mdwn', $config{srcdir}, readfile("t/test1.mdwn"));
IkiWiki::rcs_add("test1.mdwn");
- my $message = "Added the first page";
IkiWiki::rcs_commit(
file => "test1.mdwn",
message => $message,
@@ -90,10 +86,12 @@ sub test_web_add_and_commit {
}
sub test_manual_add_and_commit {
- writefile('test2.mdwn', $config{srcdir}, readfile("t/test2.mdwn"));
- system "cd $config{srcdir} && cvs add test2.mdwn >/dev/null 2>&1";
my $message = "Added the second page";
- system "cd $config{srcdir} && cvs commit -m \"$message\" test2.mdwn >/dev/null";
+ writefile('test2.mdwn', $config{srcdir}, readfile("t/test2.mdwn"));
+ system "cd $config{srcdir}"
+ . " && cvs add test2.mdwn >/dev/null 2>&1";
+ system "cd $config{srcdir}"
+ . " && cvs commit -m \"$message\" test2.mdwn >/dev/null";
my @changes = IkiWiki::rcs_recentchanges(3);
is(