02revmapdb.t #3

  • //
  • guest/
  • perforce_software/
  • revml/
  • t/
  • 02revmapdb.t
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/usr/local/bin/perl -w

=head1 NAME

02revmapdb.t - testing of VCP::RevMapDB

=cut

use strict;

use Carp;
use Test;
use File::Path;
use VCP::RevMapDB;

my $t = -d 't' ? 't/' : '' ;
my $db_loc = "${t}01db_filedb_sdbm";

rmtree [$db_loc] or die "$! unlinking $db_loc" if -e $db_loc;

my $db;

my @tests = (
sub {
   $db = VCP::RevMapDB->new( StoreLoc => $db_loc );
   ok $db;
},

sub {
   ok ! -e $db->store_loc;
},

sub {
   $db->open_db;
   ok scalar glob $db->store_loc . "/*db*";
},

sub {
   $db->set( ["a", "b"] => qw( foo bar ) );
   ok join( ",", $db->get( ["a", "b"] ) ), "foo,bar";
},

sub {
   $db->close_db;
   ok scalar glob $db->store_loc . "/db*";
},

sub {
   $db->open_db;
   ok scalar glob $db->store_loc . "/db*";
},

sub {
   ok join( ",", $db->get( ["a", "b"] ) ), "foo,bar";
},

sub {
   $db->delete_db;
   ok ! -e $db->store_loc;
},

sub {
   $db->open_db;
   ok scalar glob $db->store_loc . "/db*";
},

sub {
   $db->delete_db;
   ok ! -e $db->store_loc;
},

sub {
   rmtree [$db_loc] or warn "$! unlinking $db_loc" if -e $db_loc;
   ok 1;
},

) ;

plan tests => scalar( @tests ) ;

$_->() for @tests ;
# Change User Description Committed
#3 3155 Barrie Slaymaker Convert to logging using VCP::Logger to reduce stdout/err spew.
       Simplify & speed up debugging quite a bit.
       Provide more verbose information in logs.
       Print to STDERR progress reports to keep users from wondering
       what's going on.
       Breaks test; halfway through upgrading run3() to an inline
       function for speed and for VCP specific features.
#2 2802 John Fetkovich Added a source_repo_id to each revision, and repo_id to each
Source and Dest.  The repo_ids include repository type
(cvs,p4,revml,vss,...) and the repo_server fields.  Changed the
$self->...->set() and $self->...->get() lines in VCP::Dest::* to
pass in a conglomerated key value, by passing in the key as an
ARRAY ref.  Also various restructuring in VCP::DB.pm,
VCP::DB_file.pm and VCP::DB_file::sdbm.pm related to this
change.
#1 2723 Barrie Slaymaker Finish generalizing DB_File, implement HeadRevsDB