From cb09736fef2b456d9e0fa0efd886339d26a451bd Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 24 Jun 2004 01:41:00 +0000 Subject: Tests and fixes for the urpmi.cfg parser --- t/cfg.t | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ urpm/cfg.pm | 15 +++++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 t/cfg.t diff --git a/t/cfg.t b/t/cfg.t new file mode 100644 index 00000000..6845b890 --- /dev/null +++ b/t/cfg.t @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +use Test::More tests => 4; +use MDK::Common; + +BEGIN { use_ok 'urpm::cfg' } + +my $file = 'testurpmi.cfg'; +open my $f, '>', $file or die $!; +print $f (my $cfgtext = <{$m}{url}), " {\n"; - for (grep { $_ ne 'url' } keys %{$config->{$m}}) { + if ($m) { + print $f quotespace($m), ' ', quotespace($config->{$m}{url}), " {\n"; + } else { + print $f "{\n"; + } + for (sort grep { $_ ne 'url' } keys %{$config->{$m}}) { if (/^(update|ignore|synthesis|virtual)$/) { print $f " $_\n"; } else { @@ -143,6 +148,8 @@ sub dump_config ($$) { return 1; } +1; + __END__ =back -- cgit v1.2.1