aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-09-05 17:23:59 +0000
committerThierry Vignaud <tv@mageia.org>2012-09-05 17:23:59 +0000
commitd3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1 (patch)
tree85bd7e119b3f42097165abb53fa92cba2a362c3d /t
parent67079ebff7a5a6d43d70df1c1a574c10172d0129 (diff)
downloadperl-URPM-d3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1.tar
perl-URPM-d3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1.tar.gz
perl-URPM-d3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1.tar.bz2
perl-URPM-d3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1.tar.xz
perl-URPM-d3d0c0d8f99ab9947c9b4ac20a90dcb9e48fb2b1.zip
(parse_synthesis__XS) enable to read xz & bzip2 compressed synthesis
(backported from trunk) Including "Do not try to parse current pointer when the line is invalid or empgty" commit which fixes a "Conditional jump or move depends on uninitialised value" during empty synthesis parsing
Diffstat (limited to 't')
-rw-r--r--t/synthesis.t18
1 files changed, 14 insertions, 4 deletions
diff --git a/t/synthesis.t b/t/synthesis.t
index 6729b3b..8961e2a 100644
--- a/t/synthesis.t
+++ b/t/synthesis.t
@@ -2,29 +2,39 @@
use strict ;
use warnings ;
-use Test::More tests => 94;
+use Test::More tests => 95;
use URPM;
chdir 't' if -d 't';
my $file1 = 'synthesis.sample.cz';
+my $file2 = 'synthesis.sample-xz.cz';
-open my $f, "| gzip -9 >$file1";
-print $f <<'EOF';
+my $s = <<'EOF';
@provides@glibc-devel == 6:2.2.4-25mdk
@requires@/sbin/install-info@glibc == 2.2.4@kernel-headers@kernel-headers >= 2.2.1@/bin/sh@/bin/sh@/bin/sh@rpmlib(PayloadFilesHavePrefix) <= 4.0-1@rpmlib(CompressedFileNames) <= 3.0.4-1
@conflicts@texinfo < 3.11@gcc < 2.96-0.50mdk
@obsoletes@libc-debug@libc-headers@libc-devel@linuxthreads-devel@glibc-debug
@info@glibc-devel-2.2.4-25mdk.i586@6@45692097@Development/C
EOF
+open my $f, "| gzip -9 >$file1";
+print $f $s;
+close $f;
+open my $f, "| xz -9 >$file2";
+print $f $s;
+$s =~ s/-devel//g;
+print $f $s;
close $f;
-END { unlink $file1 }
+END { unlink $file1, $file2 }
my $a = new URPM;
ok($a);
my ($first, $end);
+($first, $end) = URPM->new->parse_synthesis($file2);
+ok($first == 0 && $end == 1, 'parse XZ synthesis');
+
($first, $end) = URPM->new->parse_synthesis('empty_synthesis.cz');
is("$first $end", "0 -1", 'parse empty synthesis');