From 043d649f677035805e2600a770074b60412a246a Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Thu, 20 Jul 2006 19:39:51 +0000 Subject: - fix test for new behaviour --- t/01distribconf.t | 21 ++++++++++++++------ test2/media/media_info/media.cfg | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 test2/media/media_info/media.cfg diff --git a/t/01distribconf.t b/t/01distribconf.t index 685718b..5cceaec 100644 --- a/t/01distribconf.t +++ b/t/01distribconf.t @@ -3,7 +3,7 @@ # $Id$ use strict; -use Test::More tests => 22; +use Test::More tests => 28; use_ok('MDV::Distribconf'); @@ -13,7 +13,7 @@ ok(!$dconf->load(), "loading wrong distrib give error"); } { -ok(my $dconf = MDV::Distribconf->new('test'), "Can get new MDV::Distribconf"); +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"); @@ -30,19 +30,28 @@ ok($dconf->getfullpath(undef, 'media_info') =~ m!^/*test/+media/media_info/?$!, 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('not_exists'), "Can get new MDV::Distribconf"); +ok(my $dconf = MDV::Distribconf->new('test2'), "Can get new MDV::Distribconf"); +$dconf->loadtree(); +print STDERR $dconf->getfullpath(undef, 'media_info'); +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: */ +} +{ +ok(my $dconf = MDV::Distribconf->new('not_exists', 1), "Can get new MDV::Distribconf"); $dconf->settree(); ok($dconf->getpath(undef, 'media_info') =~ m!^/*media/media_info/?$!, "Can get media_info path"); # vim color: */ } { -ok(my $dconf = MDV::Distribconf->new('not_exists'), "Can get new MDV::Distribconf"); +ok(my $dconf = MDV::Distribconf->new('not_exists', 1), "Can get new MDV::Distribconf"); $dconf->settree('manDraKE'); ok($dconf->getpath(undef, 'media_info') =~ m!^/*Mandrake/base/?$!, "Can get media_info path"); # vim color: */ } { -ok(my $dconf = MDV::Distribconf->new('not_exists'), "Can get new MDV::Distribconf"); +ok(my $dconf = MDV::Distribconf->new('not_exists', 1), "Can get new MDV::Distribconf"); $dconf->settree({ mediadir => 'mediadir', infodir => 'infodir', diff --git a/test2/media/media_info/media.cfg b/test2/media/media_info/media.cfg new file mode 100644 index 0000000..de96cd0 --- /dev/null +++ b/test2/media/media_info/media.cfg @@ -0,0 +1,43 @@ +# $Id$ + +[media_info] +version=2006.0 +branch=Cooker +arch=i586 +mediacfg_version=2 + +[main] +hdlist=hdlist_main.cz +size=3400m + +[debug_main] +debugfor=main + +[../SRPMS/main] +hdlist=hdlist_main.src.cz +name=Main Sources +noauto=1 + +[contrib] +hdlist=hdlist_contrib.cz +name=Contrib +size=4300m + +[debug_contrib] +debugfor=contrib + +[../SRPMS/contrib] +hdlist=hdlist_contrib.src.cz +name=Contrib Sources +noauto=1 + +[jpackage] +hdlist=hdlist_jpackage.cz +name=Jpackage +size=360m +noauto=1 + +[../SRPMS/jpackage] +hdlist=hdlist_jpackage.src.cz +name=Jpackage Sources +noauto=1 -- cgit v1.2.1