summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2006-07-24 13:58:58 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2006-07-24 13:58:58 +0000
commitf3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e (patch)
tree206328790c6d1212355074bf3130021a797aa12f /t
parentb6bbdcdb021827b75b96192d62d2099452d0a5b3 (diff)
downloadperl-MDV-Distribconf-f3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e.tar
perl-MDV-Distribconf-f3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e.tar.gz
perl-MDV-Distribconf-f3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e.tar.bz2
perl-MDV-Distribconf-f3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e.tar.xz
perl-MDV-Distribconf-f3ac84d2ed26407b8c5f8f7d5a88511cb1ad716e.zip
- factorize test for all media_cfg version
Diffstat (limited to 't')
-rw-r--r--t/01distribconf.t46
1 files changed, 19 insertions, 27 deletions
diff --git a/t/01distribconf.t b/t/01distribconf.t
index d45df08..fb7f3c4 100644
--- a/t/01distribconf.t
+++ b/t/01distribconf.t
@@ -3,7 +3,7 @@
# $Id$
use strict;
-use Test::More tests => 28;
+use Test::More tests => 35;
use_ok('MDV::Distribconf');
@@ -12,33 +12,25 @@ ok(my $dconf = MDV::Distribconf->new('/dev/null'), "Can get new MDV::Distribconf
ok(!$dconf->load(), "loading wrong distrib give error");
}
-{
-ok(my $dconf = MDV::Distribconf->new('test', 1), "Can get new MDV::Distribconf");
-ok($dconf->load(), "Can load conf");
-
-ok(scalar($dconf->listmedia) == 8, "Can list all media");
-ok(grep { $_ eq 'main' } $dconf->listmedia, "list properly media");
-
-ok($dconf->getvalue(undef, 'version') eq '2006.0', "Can get global value");
-ok($dconf->getvalue('main', 'version') eq '2006.0', "Can get global value via media");
-ok($dconf->getvalue('main', 'name') eq 'main', "Can get default name");
-ok($dconf->getvalue('contrib', 'name') eq 'Contrib', "Can get media name");
-
-ok($dconf->getpath(undef, 'root') eq 'test', "Can get root path");
-ok($dconf->getpath(undef, 'media_info') =~ m!^/*media/media_info/?$!, "Can get media_info path"); # vim color: */
-ok($dconf->getfullpath(undef, 'media_info') =~ m!^/*test/+media/media_info/?$!, "Can get media_info fullpath"); # vim color: */
-ok($dconf->getpath('main', 'path') =~ m!^/*media/+main/?$!, "Can get media path"); # vim color: */
-ok($dconf->getfullpath('main', 'path') =~ m!^/*test/*media/+main/?$!, "Can get media fullpath"); # vim color: */
-}
-{
-ok(my $dconf = MDV::Distribconf->new('test2'), "Can get new MDV::Distribconf");
-$dconf->loadtree();
-ok($dconf->getpath(undef, 'root') eq 'test2', "Can get root path");
-ok($dconf->getpath(undef, 'media_info') =~ m!^/*media/media_info/?$!, "Can get media_info path"); # vim color: */
-ok($dconf->getfullpath(undef, 'media_info') =~ m!^/*test2/+media/media_info/?$!, "Can get media_info fullpath"); # vim color: */
-ok($dconf->getpath('main', 'path') =~ m!^/*media/+main/?$!, "Can get media path"); # vim color: */
-ok($dconf->getfullpath('main', 'path') =~ m!^/*test2/*media/+main/?$!, "Can get media fullpath"); # vim color: */
+foreach my $path (qw(test test2)) {
+ ok(my $dconf = MDV::Distribconf->new($path), "Can get new MDV::Distribconf");
+ ok($dconf->load(), "Can load conf");
+
+ ok(scalar($dconf->listmedia) == 8, "Can list all media");
+ ok(grep { $_ eq 'main' } $dconf->listmedia, "list properly media");
+
+ ok($dconf->getvalue(undef, 'version') eq '2006.0', "Can get global value");
+ ok($dconf->getvalue('main', 'version') eq '2006.0', "Can get global value via media");
+ ok($dconf->getvalue('main', 'name') eq 'main', "Can get default name");
+ ok($dconf->getvalue('contrib', 'name') eq 'Contrib', "Can get media name");
+
+ ok($dconf->getpath(undef, 'root') eq $path, "Can get root path");
+ ok($dconf->getpath(undef, 'media_info') =~ m!^/*media/media_info/?$!, "Can get media_info path"); # vim color: */
+ ok($dconf->getfullpath(undef, 'media_info') =~ m!^/*$path/+media/media_info/?$!, "Can get media_info fullpath"); # vim color: */
+ ok($dconf->getpath('main', 'path') =~ m!^/*media/+main/?$!, "Can get media path"); # vim color: */
+ ok($dconf->getfullpath('main', 'path') =~ m!^/*$path/*media/+main/?$!, "Can get media fullpath"); # vim color: */
}
+
{
ok(my $dconf = MDV::Distribconf->new('not_exists', 1), "Can get new MDV::Distribconf");
$dconf->settree();