6 $dir="/tmp/ikiwiki-test-svn.$$";
9 my $svnadmin=`which svnadmin`;
11 if (! -x
$svn || ! -x
$svnadmin) {
13 use Test::More skip_all => "svn or svnadmin not available"
20 use Test
::More tests
=> 12;
22 BEGIN { use_ok
("IkiWiki"); }
24 %config=IkiWiki
::defaultconfig
();
26 $config{srcdir
} = "$dir/src";
27 $config{svnrepo
} = "$dir/repo";
28 $config{svnpath
} = "trunk";
29 IkiWiki
::loadplugins
();
30 IkiWiki
::checkconfig
();
32 my $svnrepo = "$dir/repo";
34 system "svnadmin create $svnrepo >/dev/null";
35 system "svn mkdir file://$svnrepo/trunk -m add >/dev/null";
36 system "svn co file://$svnrepo/trunk $config{srcdir} >/dev/null";
39 my $test1 = readfile
("t/test1.mdwn");
40 writefile
('test1.mdwn', $config{srcdir
}, $test1);
41 IkiWiki
::rcs_add
("test1.mdwn");
44 message
=> "Added the first page",
49 @changes = IkiWiki
::rcs_recentchanges
(3);
52 is
($changes[0]{message
}[0]{"line"}, "Added the first page");
53 is
($changes[0]{pages
}[0]{"page"}, "test1");
56 my $message = "Added the second page";
58 my $test2 = readfile
("t/test2.mdwn");
59 writefile
('test2.mdwn', $config{srcdir
}, $test2);
60 system "svn add $config{srcdir}/test2.mdwn >/dev/null";
61 system "svn commit $config{srcdir}/test2.mdwn -m \"$message\" >/dev/null";
63 @changes = IkiWiki
::rcs_recentchanges
(3);
65 is
($changes[0]{message
}[0]{"line"}, $message);
66 is
($changes[0]{pages
}[0]{"page"}, "test2");
67 is
($changes[1]{pages
}[0]{"page"}, "test1");
69 # extra slashes in the path shouldn't break things
70 $config{svnpath
} = "/trunk//";
71 IkiWiki
::checkconfig
();
72 @changes = IkiWiki
::rcs_recentchanges
(3);
74 is
($changes[0]{message
}[0]{"line"}, $message);
75 is
($changes[0]{pages
}[0]{"page"}, "test2");
76 is
($changes[1]{pages
}[0]{"page"}, "test1");