r44081 - /scripts/KGB/t/50-client.t

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sun Sep 13 20:45:07 UTC 2009


Author: dmn
Date: Sun Sep 13 20:45:00 2009
New Revision: 44081

URL: http://svn.debian.org/wsvn/?sc=1&rev=44081
Log:
add client tests

Added:
    scripts/KGB/t/50-client.t

Added: scripts/KGB/t/50-client.t
URL: http://svn.debian.org/wsvn/scripts/KGB/t/50-client.t?rev=44081&op=file
==============================================================================
--- scripts/KGB/t/50-client.t (added)
+++ scripts/KGB/t/50-client.t Sun Sep 13 20:45:00 2009
@@ -1,0 +1,126 @@
+use strict;
+use warnings;
+
+use autodie qw(:all);
+use File::Spec::Functions qw( catdir catfile );
+use Test::More tests => 30;
+
+use File::Temp qw(tempdir);
+my $r = tempdir( CLEANUP => 1 );
+
+my $repo = catdir( $r,     'repo' );
+my $wd   = catdir( $r,     'checkout' );
+my $tf = catfile( $wd, 'file' );
+
+sub poke {
+    my $f;
+    open $f, ">", $tf;
+    print $f @_;
+    close $f;
+}
+
+sub in_wd {
+    system 'sh', '-c', "cd $wd && " . shift;
+}
+
+system 'svnadmin', 'create', $repo;
+system 'svn', 'checkout', "file://$repo", $wd;
+
+poke('one');
+in_wd "svn add $tf";
+in_wd "svn ci -m 'add file'";
+
+poke('two');
+in_wd "svn ci -m 'modify file'";
+
+in_wd "svn rm file";
+poke('three');
+in_wd "svn add file";
+in_wd "svn ci -m 'replace file'";
+
+in_wd "svn rm file";
+in_wd "svn ci -m 'remove file'";
+
+ok( 1, "Test repository prepared" );
+
+use App::KGB::Client::Subversion;
+use App::KGB::Client::ServerRef;
+
+my $port = 7645;
+my $password = 'v,sjflir';
+
+my $c = new_ok(
+    'App::KGB::Client::Subversion' => [
+        {   repo_id => 'test',
+            servers => [
+                App::KGB::Client::ServerRef->new(
+                    {   uri      => "http://127.0.0.1:$port/",
+                        password => $password,
+                    }
+                ),
+            ],
+
+            #br_mod_re      => \@br_mod_re,
+            #br_mod_re_swap => $br_mod_re_swap,
+            #ignore_branch  => $ignore_branch,
+            repo_path => $repo,
+            revision  => 1,
+        }
+    ]
+);
+
+my $commit = $c->describe_commit;
+
+is( $commit->id, 1 );
+is( $commit->log, 'add file' );
+is( $commit->author, $ENV{USER} );
+is( scalar @{ $commit->changes }, 1 );
+
+my $change = $commit->changes->[0];
+is( $change->path, '/file' );
+ok( not $change->prop_change );
+is( $change->action, 'A' );
+
+$c->revision(2);
+$c->_called(0);
+$commit = $c->describe_commit;
+
+is( $commit->id, 2 );
+is( $commit->log, 'modify file' );
+is( $commit->author, $ENV{USER} );
+is( scalar @{ $commit->changes }, 1 );
+
+$change = $commit->changes->[0];
+is( $change->path, '/file' );
+ok( not $change->prop_change );
+is( $change->action, 'M' );
+
+$c->revision(3);
+$c->_called(0);
+$commit = $c->describe_commit;
+
+is( $commit->id, 3 );
+is( $commit->log, 'replace file' );
+is( $commit->author, $ENV{USER} );
+is( scalar @{ $commit->changes }, 1 );
+
+$change = $commit->changes->[0];
+is( $change->path, '/file' );
+ok( not $change->prop_change );
+is( $change->action, 'R' );
+
+$c->revision(4);
+$c->_called(0);
+$commit = $c->describe_commit;
+
+is( $commit->id, 4 );
+is( $commit->log, 'remove file' );
+is( $commit->author, $ENV{USER} );
+is( scalar @{ $commit->changes }, 1 );
+
+$change = $commit->changes->[0];
+is( $change->path, '/file' );
+ok( not $change->prop_change );
+is( $change->action, 'D' );
+
+




More information about the Pkg-perl-cvs-commits mailing list