summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-07-02 13:10:35 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-07-02 13:10:35 +0000
commit5a66423d2da34baf0896cf7781868989464b548f (patch)
tree8eac9949b8a6fc1149af1d2d5103099812cf73bc /t
parent0dcaef65a3809b25a0d40f9e8c1a4143767818da (diff)
downloadperl-MDV-Distribconf-5a66423d2da34baf0896cf7781868989464b548f.tar
perl-MDV-Distribconf-5a66423d2da34baf0896cf7781868989464b548f.tar.gz
perl-MDV-Distribconf-5a66423d2da34baf0896cf7781868989464b548f.tar.bz2
perl-MDV-Distribconf-5a66423d2da34baf0896cf7781868989464b548f.tar.xz
perl-MDV-Distribconf-5a66423d2da34baf0896cf7781868989464b548f.zip
- resync lost file after svn crash
Diffstat (limited to 't')
-rw-r--r--t/01history.t20
-rw-r--r--t/03checks.t22
-rw-r--r--t/04mediacfg.t29
3 files changed, 71 insertions, 0 deletions
diff --git a/t/01history.t b/t/01history.t
new file mode 100644
index 0000000..2c8b11d
--- /dev/null
+++ b/t/01history.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+# $Id: 01distribconf.t 56934 2006-08-21 10:16:29Z nanardon $
+
+use strict;
+use Test::More;
+use MDV::Distribconf;
+
+my @testdpath = glob('testdata/history/*/*/*');
+
+plan tests => 3 * scalar(@testdpath);
+
+foreach my $path (@testdpath) {
+ ok(
+ my $dconf = MDV::Distribconf->new($path),
+ "Can get new MDV::Distribconf"
+ );
+ ok($dconf->load(), "can load $path");
+ ok($dconf->listmedia(), "can list media");
+}
diff --git a/t/03checks.t b/t/03checks.t
new file mode 100644
index 0000000..3beb2ac
--- /dev/null
+++ b/t/03checks.t
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+# $Id: 01-compile.t 38877 2006-07-12 12:16:51Z nanardon $
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use_ok('MDV::Distribconf::Checks');
+
+MDV::Distribconf::Checks::_report_err(
+ sub {
+ my %err = @_;
+ is($err{errcode}, 'UNSYNC_HDLIST', 'get proper errcode');
+ is($err{level}, 'E', 'get proper err level');
+ ok($err{message}, 'get message');
+ },
+ 'UNSYNC_HDLIST',
+ 'test message',
+);
+
diff --git a/t/04mediacfg.t b/t/04mediacfg.t
new file mode 100644
index 0000000..b5c1237
--- /dev/null
+++ b/t/04mediacfg.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 11;
+
+use MDV::Distribconf::Build;
+use_ok('MDV::Distribconf::MediaCFG');
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'name', 'toto'), 0,
+ "Valid value return no error");
+
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1'), 0,
+ "valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1k'), 0,
+ "valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1d'), 1,
+ "non valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', 'coin'), 1,
+ "non valide size value");
+
+my $mdc = MDV::Distribconf::Build->new("testdata/testa");
+
+ok($mdc->load, "Can't load distrib tree");
+
+ok($mdc->check_index_sync('first'), "Check media hdlist sync with rpms, good case");
+ok(!$mdc->check_index_sync('second'), "Check media hdlist sync with rpms, bad case");
+
+ok($mdc->check_media_md5('first_src'), "Check hdlist md5sum validity, good case");
+ok(!$mdc->check_media_md5('second_src'), "Check hdlist md5sum validity, bad case");