aboutsummaryrefslogtreecommitdiff
path: root/t/cvs.t
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2012-02-01 15:17:57 -0500
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2012-02-01 15:17:57 -0500
commitfc316b9da190c3dd8b7dd28541f70d4dbf3bce91 (patch)
tree4cc786565dc227eb797b66f6c3aed33cf65eaeef /t/cvs.t
parentb0d97cd20eb52a7924149df86ae64e837d023b65 (diff)
downloadikiwiki-fc316b9da190c3dd8b7dd28541f70d4dbf3bce91.tar
ikiwiki-fc316b9da190c3dd8b7dd28541f70d4dbf3bce91.tar.gz
Express rcs_recentchanges() tests via utility functions, in preparation
for writing more thorough tests, in order to safely extract the cvsps output-parsing routine for reuse by an upcoming rcs_revert().
Diffstat (limited to 't/cvs.t')
-rwxr-xr-xt/cvs.t34
1 files changed, 15 insertions, 19 deletions
diff --git a/t/cvs.t b/t/cvs.t
index 62ed179f3..5f5ba30a9 100755
--- a/t/cvs.t
+++ b/t/cvs.t
@@ -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
@@ -347,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