6 $dir="/tmp/ikiwiki-test-cvs.$$";
9 my $cvsps=`which cvsps`;
11 if (! -x
$cvs || ! -x
$cvsps || ! mkdir($dir)) {
13 use Test::More skip_all => "cvs or cvsps not available or could not make test dir"
16 foreach my $module ('File::ReadBackwards', 'File::MimeInfo') {
20 use Test
::More skip_all
=> "$module not available"
25 use Test
::More tests
=> 12;
27 BEGIN { use_ok
("IkiWiki"); }
29 %config=IkiWiki
::defaultconfig
();
31 $config{srcdir
} = "$dir/src";
32 $config{cvsrepo
} = "$dir/repo";
33 $config{cvspath
} = "ikiwiki";
34 IkiWiki
::loadplugins
();
35 IkiWiki
::checkconfig
();
37 my $cvsrepo = "$dir/repo";
39 system "cvs -d $cvsrepo init >/dev/null";
40 system "mkdir $dir/ikiwiki >/dev/null";
41 system "cd $dir/ikiwiki && cvs -d $cvsrepo import -m import ikiwiki VENDOR RELEASE >/dev/null";
42 system "rm -rf $dir/ikiwiki >/dev/null";
43 system "cvs -d $cvsrepo co -d $config{srcdir} ikiwiki >/dev/null";
46 my $test1 = readfile
("t/test1.mdwn");
47 writefile
('test1.mdwn', $config{srcdir
}, $test1);
48 IkiWiki
::rcs_add
("test1.mdwn");
49 IkiWiki
::rcs_commit
("test1.mdwn", "Added the first page", "moo");
52 @changes = IkiWiki
::rcs_recentchanges
(3);
55 is
($changes[0]{message
}[0]{"line"}, "Added the first page");
56 is
($changes[0]{pages
}[0]{"page"}, "test1");
59 my $message = "Added the second page";
61 my $test2 = readfile
("t/test2.mdwn");
62 writefile
('test2.mdwn', $config{srcdir
}, $test2);
63 system "cd $config{srcdir} && cvs add test2.mdwn >/dev/null 2>&1";
64 system "cd $config{srcdir} && cvs commit -m \"$message\" test2.mdwn >/dev/null";
66 @changes = IkiWiki
::rcs_recentchanges
(3);
68 is
($changes[0]{message
}[0]{"line"}, $message);
69 is
($changes[0]{pages
}[0]{"page"}, "test2");
70 is
($changes[1]{pages
}[0]{"page"}, "test1");
72 # extra slashes in the path shouldn't break things
73 $config{cvspath
} = "/ikiwiki//";
74 IkiWiki
::checkconfig
();
75 @changes = IkiWiki
::rcs_recentchanges
(3);
77 is
($changes[0]{message
}[0]{"line"}, $message);
78 is
($changes[0]{pages
}[0]{"page"}, "test2");
79 is
($changes[1]{pages
}[0]{"page"}, "test1");