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");
50 files
=> "test1.mdwn",
51 message
=> "Added the first page",
56 @changes = IkiWiki
::rcs_recentchanges
(3);
59 is
($changes[0]{message
}[0]{"line"}, "Added the first page");
60 is
($changes[0]{pages
}[0]{"page"}, "test1");
63 my $message = "Added the second page";
65 my $test2 = readfile
("t/test2.mdwn");
66 writefile
('test2.mdwn', $config{srcdir
}, $test2);
67 system "cd $config{srcdir} && cvs add test2.mdwn >/dev/null 2>&1";
68 system "cd $config{srcdir} && cvs commit -m \"$message\" test2.mdwn >/dev/null";
70 @changes = IkiWiki
::rcs_recentchanges
(3);
72 is
($changes[0]{message
}[0]{"line"}, $message);
73 is
($changes[0]{pages
}[0]{"page"}, "test2");
74 is
($changes[1]{pages
}[0]{"page"}, "test1");
76 # extra slashes in the path shouldn't break things
77 $config{cvspath
} = "/ikiwiki//";
78 IkiWiki
::checkconfig
();
79 @changes = IkiWiki
::rcs_recentchanges
(3);
81 is
($changes[0]{message
}[0]{"line"}, $message);
82 is
($changes[0]{pages
}[0]{"page"}, "test2");
83 is
($changes[1]{pages
}[0]{"page"}, "test1");