diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-17 16:25:14 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-17 16:25:14 +0000 |
commit | 6111ce37d4a132972730ee29525d246000c28311 (patch) | |
tree | 2ab715118cb453f2d18bb58b7b6e9c1496467a59 | |
parent | a684773347534dae69c29f4a3e6006b2b6541a2a (diff) | |
download | perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.gz perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.bz2 perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.xz perl-URPM-6111ce37d4a132972730ee29525d246000c28311.zip |
- parse_hdlist on a simple header was broken because pid was left unset,
- add some tests for this
-rw-r--r-- | URPM.xs | 2 | ||||
-rw-r--r-- | t/parse.t | 14 |
2 files changed, 14 insertions, 2 deletions
@@ -3077,7 +3077,7 @@ Urpm_parse_hdlist__XS(urpm, filename, ...) HV *provides = fprovides && SvROK(*fprovides) && SvTYPE(SvRV(*fprovides)) == SVt_PVHV ? (HV*)SvRV(*fprovides) : NULL; if (depslist != NULL) { - pid_t pid; + pid_t pid = 0; int d; int empty_archive = 0; FD_t fd; @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 35; use MDV::Packdrakeng; use URPM; use URPM::Build; @@ -44,6 +44,7 @@ ok(-f 'hdlist.cz'); my $b = new URPM; ($start, $end) = $b->parse_hdlist('hdlist.cz', keep_all_tags => 1); +is("$start $end", "0 0", 'parse_hdlist'); ok(@{$b->{depslist}} == 1); $pkg = $b->{depslist}[0]; ok($pkg); @@ -53,6 +54,17 @@ is($pkg->get_tag(1002), '1mdk', 'release'); is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch", q/get headers from hdlist/); +my $headers = eval { [ $b->parse_rpms_build_headers(rpms => [ "t/RPMS/noarch/test-rpm-1.0-1mdk.noarch.rpm" ], + dir => 't/headers') ] }; +is($@, '', 'parse_rpms_build_headers'); +is(int @$headers, 1, 'parse_rpms_build_headers'); +ok(@{$b->{depslist}} == 2); +($start, $end) = eval { $b->parse_headers(dir => "t/headers", headers => $headers) }; +is($@, '', 'parse_headers'); +is("$start $end", "2 2", 'parse_headers'); + + + # Version comparison ok(URPM::rpmvercmp("1-1mdk", "1-1mdk") == 0, "Same value = 0"); ok(URPM::rpmvercmp("0:1-1mdk", "1-1mdk") == -1, "Same value, epoch 0 on left = 1"); |