diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-02-05 15:59:42 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-02-05 15:59:42 -0500 |
commit | f92505d78b82c6ac146e43054ebd12441575a602 (patch) | |
tree | 2897a21c04f473ee3100a6a59ccce6336a1f7692 /t | |
parent | fbe2ab4419e086ff84991bf25f1549aaabc5143b (diff) | |
parent | 11f4942d68f3276bfdc4688e4091e559f9481874 (diff) | |
download | ikiwiki-f92505d78b82c6ac146e43054ebd12441575a602.tar ikiwiki-f92505d78b82c6ac146e43054ebd12441575a602.tar.gz |
Merge branch 'master' into prefix-directives
Diffstat (limited to 't')
-rwxr-xr-x | t/bazaar.t | 62 | ||||
-rwxr-xr-x | t/pagespec_match.t | 5 | ||||
-rwxr-xr-x | t/svn.t | 9 |
3 files changed, 68 insertions, 8 deletions
diff --git a/t/bazaar.t b/t/bazaar.t new file mode 100755 index 000000000..f064814fe --- /dev/null +++ b/t/bazaar.t @@ -0,0 +1,62 @@ +#!/usr/bin/perl +use warnings; +use strict; +my $dir; +BEGIN { + $dir = "/tmp/ikiwiki-test-bzr.$$"; + my $bzr=`which bzr`; + chomp $bzr; + if (! -x $bzr || ! mkdir($dir)) { + eval q{ + use Test::More skip_all => "bzr not available or could not make test dir" + } + } +} +use Test::More tests => 11; + +BEGIN { use_ok("IkiWiki"); } + +%config=IkiWiki::defaultconfig(); +$config{rcs} = "bzr"; +$config{srcdir} = "$dir/repo"; +IkiWiki::checkconfig(); + +system "bzr init $config{srcdir}"; + +# Web commit +my $test1 = readfile("t/test1.mdwn"); +writefile('test1.mdwn', $config{srcdir}, $test1); +IkiWiki::rcs_add("test1.mdwn"); +IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo", "Joe User"); + +my @changes; +@changes = IkiWiki::rcs_recentchanges(3); + +is($#changes, 0); +is($changes[0]{message}[0]{"line"}, "Added the first page"); +is($changes[0]{pages}[0]{"page"}, "test1.mdwn"); +is($changes[0]{user}, "Joe User"); + +# Manual commit +my $username = "Foo Bar"; +my $user = "$username <foo.bar\@example.com>"; +my $message = "Added the second page"; + +my $test2 = readfile("t/test2.mdwn"); +writefile('test2.mdwn', $config{srcdir}, $test2); +system "bzr add $config{srcdir}/test2.mdwn"; +system "bzr commit --author \"$user\" -m \"$message\" $config{srcdir}"; + +@changes = IkiWiki::rcs_recentchanges(3); + +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[1]{pages}[0]{"page"}, "test1.mdwn"); + +my $ctime = IkiWiki::rcs_getctime("test2.mdwn"); +ok($ctime >= time() - 20); + +system "rm -rf $dir"; diff --git a/t/pagespec_match.t b/t/pagespec_match.t index 3a641c6a8..038472967 100755 --- a/t/pagespec_match.t +++ b/t/pagespec_match.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 54; +use Test::More tests => 52; BEGIN { use_ok("IkiWiki"); } @@ -67,9 +67,6 @@ ok(! pagespec_match("foo", "creation_day(3)"), "other day"); ok(! pagespec_match("foo", "no_such_function(foo)"), "foo"); -ok(pagespec_match("foo", "foo and user(bar)", user => "bar"), "user"); -ok(! pagespec_match("foo", "foo and user(bar)", user => "baz"), "user fail"); - my $ret=pagespec_match("foo", "(invalid"); ok(! $ret, "syntax error"); ok($ret eq "syntax error", "error message"); @@ -21,13 +21,14 @@ BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); $config{rcs} = "svn"; $config{srcdir} = "$dir/src"; -$config{svnrepo} = "$dir/repo"; $config{svnpath} = "trunk"; IkiWiki::checkconfig(); -system "svnadmin create $config{svnrepo} >/dev/null"; -system "svn mkdir file://$config{svnrepo}/trunk -m add >/dev/null"; -system "svn co file://$config{svnrepo}/trunk $config{srcdir} >/dev/null"; +my $svnrepo = "$dir/repo"; + +system "svnadmin create $svnrepo >/dev/null"; +system "svn mkdir file://$svnrepo/trunk -m add >/dev/null"; +system "svn co file://$svnrepo/trunk $config{srcdir} >/dev/null"; # Web commit my $test1 = readfile("t/test1.mdwn"); |