update rcs tests for new rcs plugin load method

As a side effect, since loadplugins is called, mdwn is loaded, so
rcs_recentchanges will return page names, not filenames, for mdwn files.
master
Joey Hess 2008-08-01 16:03:23 -04:00
parent f41448d9ca
commit 2faf1ec601
4 changed files with 22 additions and 18 deletions

View File

@ -19,6 +19,7 @@ BEGIN { use_ok("IkiWiki"); }
%config=IkiWiki::defaultconfig();
$config{rcs} = "bzr";
$config{srcdir} = "$dir/repo";
IkiWiki::loadplugins();
IkiWiki::checkconfig();
system "bzr init $config{srcdir}";
@ -34,7 +35,7 @@ my @changes;
is($#changes, 0);
is($changes[0]{message}[0]{"line"}, "Added the first page");
is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test1");
is($changes[0]{user}, "Joe User");
# Manual commit
@ -52,9 +53,9 @@ system "bzr commit --quiet --author \"$user\" -m \"$message\" $config{srcdir}";
is($#changes, 1);
is($changes[0]{message}[0]{"line"}, $message);
is($changes[0]{user}, $username);
is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
is($changes[0]{pages}[0]{"page"}, "test2");
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
is($changes[1]{pages}[0]{"page"}, "test1");
my $ctime = IkiWiki::rcs_getctime("test2.mdwn");
ok($ctime >= time() - 20);
@ -67,7 +68,7 @@ IkiWiki::rcs_commit_staged("Added the 4th page", "moo", "Joe User");
@changes = IkiWiki::rcs_recentchanges(4);
is($#changes, 2);
is($changes[0]{pages}[0]{"page"}, "test4.mdwn");
is($changes[0]{pages}[0]{"page"}, "test4");
ok(mkdir($config{srcdir}."/newdir"));
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
@ -76,7 +77,7 @@ IkiWiki::rcs_commit_staged("Added the 5th page", "moo", "Joe User");
@changes = IkiWiki::rcs_recentchanges(4);
is($#changes, 3);
is($changes[0]{pages}[0]{"page"}, "newdir/test5.mdwn");
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
IkiWiki::rcs_remove("newdir/test5.mdwn");
IkiWiki::rcs_commit_staged("Remove the 5th page", "moo", "Joe User");

11
t/git.t
View File

@ -22,6 +22,7 @@ BEGIN { use_ok("IkiWiki"); }
%config=IkiWiki::defaultconfig();
$config{rcs} = "git";
$config{srcdir} = "$dir/src";
IkiWiki::loadplugins();
IkiWiki::checkconfig();
system "cd $gitrepo && git init >/dev/null 2>&1";
@ -46,7 +47,7 @@ IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo");
is($#changes, 1);
is($changes[0]{message}[0]{"line"}, "Added the first page");
is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test1");
# Manual commit
my $message = "Added the second page";
@ -61,9 +62,9 @@ system "cd $config{srcdir}; git push origin >/dev/null 2>&1";
is($#changes, 2);
is($changes[0]{message}[0]{"line"}, $message);
is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
is($changes[0]{pages}[0]{"page"}, "test2");
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
is($changes[1]{pages}[0]{"page"}, "test1");
# Renaming
@ -75,7 +76,7 @@ IkiWiki::rcs_commit_staged("Added the 4th page", "moo", "Joe User");
@changes = IkiWiki::rcs_recentchanges(4);
is($#changes, 3);
is($changes[0]{pages}[0]{"page"}, "test4.mdwn");
is($changes[0]{pages}[0]{"page"}, "test4");
ok(mkdir($config{srcdir}."/newdir"));
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
@ -84,7 +85,7 @@ IkiWiki::rcs_commit_staged("Added the 5th page", "moo", "Joe User");
@changes = IkiWiki::rcs_recentchanges(4);
is($#changes, 3);
is($changes[0]{pages}[0]{"page"}, "newdir/test5.mdwn");
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
IkiWiki::rcs_remove("newdir/test5.mdwn");
IkiWiki::rcs_commit_staged("Remove the 5th page", "moo", "Joe User");

View File

@ -19,6 +19,7 @@ BEGIN { use_ok("IkiWiki"); }
%config=IkiWiki::defaultconfig();
$config{rcs} = "mercurial";
$config{srcdir} = "$dir/repo";
IkiWiki::loadplugins();
IkiWiki::checkconfig();
system "hg init $config{srcdir}";
@ -34,7 +35,7 @@ my @changes;
is($#changes, 0);
is($changes[0]{message}[0]{"line"}, "Added the first page");
is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test1");
is($changes[0]{user}, "Joe User");
# Manual commit
@ -52,9 +53,9 @@ system "hg commit -R $config{srcdir} -u \"$user\" -m \"$message\" -d \"0 0\"";
is($#changes, 1);
is($changes[0]{message}[0]{"line"}, $message);
is($changes[0]{user}, $username);
is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
is($changes[0]{pages}[0]{"page"}, "test2");
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
is($changes[1]{pages}[0]{"page"}, "test1");
my $ctime = IkiWiki::rcs_getctime("test2.mdwn");
is($ctime, 0);

11
t/svn.t
View File

@ -23,6 +23,7 @@ $config{rcs} = "svn";
$config{srcdir} = "$dir/src";
$config{svnrepo} = "$dir/repo";
$config{svnpath} = "trunk";
IkiWiki::loadplugins();
IkiWiki::checkconfig();
my $svnrepo = "$dir/repo";
@ -42,7 +43,7 @@ my @changes;
is($#changes, 0);
is($changes[0]{message}[0]{"line"}, "Added the first page");
is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test1");
# Manual commit
my $message = "Added the second page";
@ -55,8 +56,8 @@ system "svn commit $config{srcdir}/test2.mdwn -m \"$message\" >/dev/null";
@changes = IkiWiki::rcs_recentchanges(3);
is($#changes, 1);
is($changes[0]{message}[0]{"line"}, $message);
is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test2");
is($changes[1]{pages}[0]{"page"}, "test1");
# extra slashes in the path shouldn't break things
$config{svnpath} = "/trunk//";
@ -64,7 +65,7 @@ IkiWiki::checkconfig();
@changes = IkiWiki::rcs_recentchanges(3);
is($#changes, 1);
is($changes[0]{message}[0]{"line"}, $message);
is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
is($changes[0]{pages}[0]{"page"}, "test2");
is($changes[1]{pages}[0]{"page"}, "test1");
system "rm -rf $dir";