diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-06-27 23:53:08 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-06-27 23:53:08 +0000 |
commit | f08fbba859b2c21b85c5aa7170c704271e0ca62d (patch) | |
tree | ca75f5b36ecd6d37a156068f141f7dca81155ce6 /t/01setter-getter.t | |
parent | f3a5346c94ceed8c28a10511db0b1019ec532971 (diff) | |
parent | 0f5e4ddc50cf8f93de30d8c10477fff5d9d99282 (diff) | |
download | perl-URPM-f08fbba859b2c21b85c5aa7170c704271e0ca62d.tar perl-URPM-f08fbba859b2c21b85c5aa7170c704271e0ca62d.tar.gz perl-URPM-f08fbba859b2c21b85c5aa7170c704271e0ca62d.tar.bz2 perl-URPM-f08fbba859b2c21b85c5aa7170c704271e0ca62d.tar.xz perl-URPM-f08fbba859b2c21b85c5aa7170c704271e0ca62d.zip |
add new t/01setter-getter.t to MANIFEST
Diffstat (limited to 't/01setter-getter.t')
-rw-r--r-- | t/01setter-getter.t | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/t/01setter-getter.t b/t/01setter-getter.t new file mode 100644 index 0000000..871433d --- /dev/null +++ b/t/01setter-getter.t @@ -0,0 +1,69 @@ +#!/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'); +} + + + |