X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/1d176f23d265de80663390788b71cbd96c988ee2..a97f508bb5b06597168e3f24765c76e7e64618b4:/t/cvs.t diff --git a/t/cvs.t b/t/cvs.t index af91b1c64..9afd5a7e9 100755 --- a/t/cvs.t +++ b/t/cvs.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More; my $total_tests = 41; +use Test::More; my $total_tests = 42; use IkiWiki; my $default_test_methods = '^test_*'; @@ -269,29 +269,20 @@ sub test_rcs_rename { } sub test_rcs_recentchanges { + my @changes = IkiWiki::rcs_recentchanges(3); + is_total_number_of_changes(\@changes, 0); + my $message = "Add a page via CVS directly"; - writefile('test2.mdwn', $config{srcdir}, readfile("t/test2.mdwn")); + my $file = q{test2.mdwn}; + writefile($file, $config{srcdir}, readfile(q{t/test2.mdwn})); system "cd $config{srcdir}" - . " && cvs add test2.mdwn >/dev/null 2>&1"; + . " && cvs add $file >/dev/null 2>&1"; system "cd $config{srcdir}" - . " && cvs commit -m \"$message\" test2.mdwn >/dev/null"; + . " && cvs commit -m \"$message\" $file >/dev/null"; - my @changes = IkiWiki::rcs_recentchanges(3); - is( - $#changes, - 0, - q{total commits: 1}, - ); - is( - $changes[0]{message}[0]{"line"}, - $message, - q{most recent commit's first message line matches}, - ); - is( - $changes[0]{pages}[0]{"page"}, - "test2", - q{most recent commit's first pagename matches}, - ); + @changes = IkiWiki::rcs_recentchanges(3); + is_total_number_of_changes(\@changes, 1); + is_most_recent_change(\@changes, stripext($file), $message); # CVS commits run ikiwiki once for every committed file (!) # - commit_prep alone should fix this @@ -333,7 +324,10 @@ sub test_rcs_getmtime { } sub test_rcs_receive { - pass(q{rcs_receive doesn't make sense for CVS}); + my $description = q{rcs_receive doesn't make sense for CVS}; + exists $IkiWiki::hooks{rcs}{rcs_receive} + ? fail($description) + : pass($description); } sub test_rcs_preprevert { @@ -344,6 +338,11 @@ sub test_rcs_preprevert { } sub test_rcs_revert { + # test rcs_recentchanges() real darn well + # extract read-backwards patchset parser from rcs_recentchanges() + # recentchanges: given max, return list of changeset/files/etc. + # revert: given changeset ID, return list of file/rev/action + # # can it assume we're under CVS control? or must it check? # given a patchset number, stage the revert for rcs_commit_staged() # if commit succeeds, return undef