1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/usr/local/bin/perl -w
=head1 NAME
03dest_metadb.t - testing of VCP::Dest::metadb services
=cut
use strict ;
use Carp ;
use Test ;
use VCP::Dest::metadb;
my $p;
my $o;
my @options = (
"--repo-id=repo-idfoo",
"--db-dir=db-dirfoo",
);
my @tests = (
sub {
$p = VCP::Dest::metadb->new( "metadb" ) ;
ok ref $p, 'VCP::Dest::metadb';
},
sub {
$o = join( " ", map "'$_'", $p->options_as_strings );
ok length $o;
},
(
map {
my $option = $_;
$option =~ s/=.*//;
sub {
ok 0 <= index( $o, "'#$option" ), 1, $option;
};
} @options
),
sub {
$p->parse_options( [ @options ] );
$o = join( " ", map "'$_'", $p->options_as_strings );
ok length $o;
},
(
map {
my $option = $_;
sub {
ok 0 <= index( $o, "'$option'" ), 1, $option;
};
} @options
),
sub {
$o = $p->config_file_section_as_string;
ok $o;
},
(
map {
my $option = $_;
$option =~ s/^--?//;
$option =~ s/=.*//;
sub {
ok 0 <= index( $o, $option ), 1, "$option documented";
};
} @options
),
) ;
plan tests => scalar( @tests ) ;
$_->() for @tests ;
|