diff options
Diffstat (limited to 't')
-rw-r--r-- | t/01setter-getter.t | 69 | ||||
-rw-r--r-- | t/fatal.t | 4 | ||||
-rw-r--r-- | t/parse.t | 15 | ||||
-rw-r--r-- | t/synthesis.t | 20 |
4 files changed, 18 insertions, 90 deletions
diff --git a/t/01setter-getter.t b/t/01setter-getter.t deleted file mode 100644 index 871433d..0000000 --- a/t/01setter-getter.t +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use Test::More tests => 63; -use URPM; - - -chdir 't' if -d 't'; - -my $u = URPM->new; -ok($u, 'URPM'); - -$u->parse_rpm("tmp/RPMS/noarch/test-rpm-1.0-1mdk.noarch.rpm"); -ok(@{$u->{depslist}} == 1, 'depslist'); - -my $pkg = $u->{depslist}[0]; -ok($pkg, 'Package'); - -is($pkg->rflags, undef, 'default rflags'); -is($pkg->set_rflags(1, 3), undef, 'storing rflags'); -is(join(',', $pkg->set_rflags(1, 4)), "1,3", 'storing rflags'); -is(join(',', $pkg->rflags), "1,4", 'retrieving stored rflags'); - -######################################## - -test_flags($pkg, ()); - -$pkg->set_flag_skip; -test_flags($pkg, skip => 33554432); -$pkg->set_flag_skip(0); - -$pkg->set_flag_base; -test_flags($pkg, base => 16777216); -$pkg->set_flag_base(0); - -$pkg->set_flag_installed; -test_flags($pkg, installed => 134217728); -$pkg->set_flag_installed(0); - -$pkg->set_flag_upgrade; -test_flags($pkg, upgrade => 1073741824); -$pkg->set_flag_upgrade(0); - -$pkg->set_flag_required; -test_flags($pkg, required => 536870912); -$pkg->set_flag_required(0); - -$pkg->set_flag_requested; -test_flags($pkg, requested => 268435456); -$pkg->set_flag_requested(0); - -$pkg->set_flag_disable_obsolete; -test_flags($pkg, disable_obsolete => 67108864); -$pkg->set_flag_disable_obsolete(0); - -sub test_flags { - my ($pkg, %flags) = @_; - is($pkg->flag_base, $flags{base} || 0, 'base flag'); - is($pkg->flag_skip, $flags{skip} || 0, 'skip flag'); - is($pkg->flag_disable_obsolete, $flags{disable_obsolete} || 0, 'disable_obsolete flag'); - is($pkg->flag_installed, $flags{installed} || 0, 'installed flag'); - is($pkg->flag_requested, $flags{requested} || 0, 'requested flag'); - is($pkg->flag_required, $flags{required} || 0, 'required flag'); - is($pkg->flag_upgrade, $flags{upgrade} || 0, 'upgrade flag'); -} - - - @@ -4,7 +4,7 @@ use strict; use Test::More tests => 8; use URPM; -my $u = URPM->new; +my $u = new URPM; eval { $u->parse_hdlist('non-existent'); }; like( $@, qr/^cannot open hdlist file non-existent/, 'fatal error on hdlist not found' ); @@ -13,7 +13,7 @@ eval { $u->parse_synthesis('non-existent'); }; like( $@, qr/^unable to read synthesis file non-existent/, 'fatal error on synthesis not found' ); is( $! + 0, $!{ENOENT}, '$! is ENOENT' ); -my $v = URPM->new( nofatal => 1 ); +my $v = new URPM( nofatal => 1 ); eval { $v->parse_hdlist('non-existent'); }; is( $@, '', 'no error on hdlist not found' ); @@ -4,18 +4,18 @@ use strict; use warnings; -use Test::More tests => 38; +use Test::More tests => 39; use MDV::Packdrakeng; use URPM; use URPM::Build; - +use URPM::Query; chdir 't' if -d 't'; # shut up URPM::setVerbosity(2); -my $a = URPM->new; +my $a = new URPM; ok($a); END { system('rm -rf hdlist.cz empty_hdlist.cz headers tmp') } @@ -54,7 +54,7 @@ $a->build_hdlist( ok(-f 'hdlist.cz'); -my $b = URPM->new; +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); @@ -65,6 +65,9 @@ is($pkg->get_tag(1001), '1.0', 'version'); 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)); +rpm_is_jbj_version() ? + ok($pkg->is_platform_compat() > 0, "can evaluate platform score") : + pass('no platform compat'); my $headers = eval { [ $b->parse_rpms_build_headers(rpms => [ "tmp/RPMS/noarch/test-rpm-1.0-1mdk.noarch.rpm" ], dir => 'headers') ] }; @@ -110,3 +113,7 @@ ok(URPM::rpmvercmp("1:1-1mdk", "2:1-1mdk") == -1, "epoch 1 vs 2 = -1"); END { unlink "bad.spec" } } +sub rpm_is_jbj_version { + # checking for --yaml support + `rpm --help` =~ /yaml/; +} diff --git a/t/synthesis.t b/t/synthesis.t index 4d9d79b..6729b3b 100644 --- a/t/synthesis.t +++ b/t/synthesis.t @@ -2,39 +2,29 @@ use strict ; use warnings ; -use Test::More tests => 95; +use Test::More tests => 94; use URPM; chdir 't' if -d 't'; my $file1 = 'synthesis.sample.cz'; -my $file2 = 'synthesis.sample-xz.cz'; -my $s = <<'EOF'; +open my $f, "| gzip -9 >$file1"; +print $f <<'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, $file2 } +END { unlink $file1 } -my $a = URPM->new; +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'); |