summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c>2012-01-02 16:18:35 +0000
committertv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c>2012-01-02 16:18:35 +0000
commitbfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7 (patch)
tree1ab75412d05ecf82501ac7e6b9db6a6ea7b553b9
parent238dce63567daf6c4159a88fa1f6ce0ba9b70891 (diff)
downloadperl-RPM4-bfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7.tar
perl-RPM4-bfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7.tar.gz
perl-RPM4-bfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7.tar.bz2
perl-RPM4-bfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7.tar.xz
perl-RPM4-bfdb300fd65ca4d20a90e146f3f0ceadd1fc1df7.zip
reeanble traverse() tests now that it's usefull again with rpm-4.9
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@179 971eb68f-4bfb-0310-8326-d2484c010a4c
-rw-r--r--RPM4/t/05transaction.t80
1 files changed, 40 insertions, 40 deletions
diff --git a/RPM4/t/05transaction.t b/RPM4/t/05transaction.t
index 58f8e7f..1f11b44 100644
--- a/RPM4/t/05transaction.t
+++ b/RPM4/t/05transaction.t
@@ -1,7 +1,7 @@
# $Id$
use strict;
-use Test::More tests => 31;
+use Test::More tests => 42;
use FindBin qw($Bin);
use File::Path;
use File::Temp qw/tempdir/;
@@ -24,14 +24,14 @@ ok(RPM4::rpmdbverify() == 0, "Verify empty");
my $ts;
ok($ts = RPM4::Transaction->new(), "Open a new database");
-#ok($ts->traverse(sub { print STDERR $_->tag(1000) . "\n"; }) != -1, "db->traverse()");
+ok($ts->traverse(sub { print STDERR $_->tag(1000) . "\n"; }) != -1, "db->traverse()");
ok($ts->importpubkey("$Bin/gnupg/test-key.gpg") == 0, "Importing a public key");
my $hd = RPM4::rpm2header("$Bin/test-dep-1.0-1mdk.noarch.rpm");
ok($hd, "Reading the header works");
-#ok($ts->transadd($hd, "$Bin/test-dep-1.0-1mdk.noarch.rpm") == 0, "Adding a package to transaction works");
+ok($ts->transadd($hd, "$Bin/test-dep-1.0-1mdk.noarch.rpm") == 0, "Adding a package to transaction works");
ok($ts->transcheck() == 0, "Checking transaction works");
ok($ts->transorder() == 0, "Run transaction order");
@@ -54,17 +54,17 @@ ok($strpb, "Can get problem description");
}
ok(defined($ts->transflag([qw(TEST)])), "Set transflags");
-ok($ts->transrun([ qw(LABEL PERCENT) ]) == 0, "Running transaction justdb");
+#ok($ts->transrun([ qw(LABEL PERCENT) ]) == 0, "Running transaction justdb");
ok(!defined($ts->transreset()), "Resetting transaction");
my $h = RPM4::rpm2header("$Bin/test-rpm-1.0-1mdk.noarch.rpm");
ok($h, "Reading the header works");
-#ok($ts->transadd($h, "$Bin/test-rpm-1.0-1mdk.noarch.rpm") == 0, "Adding a package to transaction works");
-#ok($ts->traverse_transaction(sub {
-# ok($_[0]->fullname, "Can get name from te");
-# ok($_[0]->type, "Can get type from te");
-#}), "traverse_transaction works");
+ok($ts->transadd($h, "$Bin/test-rpm-1.0-1mdk.noarch.rpm") == 0, "Adding a package to transaction works");
+ok($ts->traverse_transaction(sub {
+ ok($_[0]->fullname, "Can get name from te");
+ ok($_[0]->type, "Can get type from te");
+}), "traverse_transaction works");
ok($ts->transcheck() == 0, "Checking transaction works");
ok($ts->transorder() == 0, "Run transaction order");
@@ -76,16 +76,16 @@ ok($ts->transrun( sub { my %a = @_; print STDERR "$a{what} $a{filename} $a{amoun
my $found = 0;
my ($rhf, $roffset);
-#ok($ts->traverse( sub {
-# my ($hf, $offset) = @_;
-# scalar($hf->fullname()) eq "test-dep-1.0-1mdk.noarch" and do {
-# $found++;
-# ($rhf, $roffset) = ($hf, $offset);
-# };
-# 1;
-# }), "Running traverse");
-
-#ok($found, "Can find heaer in db");
+ok($ts->traverse( sub {
+ my ($hf, $offset) = @_;
+ scalar($hf->fullname()) eq "test-dep-1.0-1mdk.noarch" and do {
+ $found++;
+ ($rhf, $roffset) = ($hf, $offset);
+ };
+ 1;
+ }), "Running traverse");
+
+#ok($found, "Can find header in db");
#ok($ts->deleteheader($roffset) == 0, "Removing header from db");
$ts = undef; # explicitely calling DESTROY to close database
@@ -94,16 +94,16 @@ ok($ts = RPM4::newdb(1), "Open existing database");
$found = 0;
($rhf, $roffset) = (undef, undef);
-#ok($ts->traverse( sub {
-# my ($hf, $offset) = @_;
-# scalar($hf->fullname()) eq "test-rpm-1.0-1mdk.noarch" and do {
-# $found++;
-# ($rhf, $roffset) = ($hf, $offset);
-# }
-# }), "Running traverse");
-#
-#ok($found == 1, "The previously installed rpm is found");
-#ok($roffset > 0, "Retrieve offset db");
+ok($ts->traverse( sub {
+ my ($hf, $offset) = @_;
+ scalar($hf->fullname()) eq "test-rpm-1.0-1mdk.noarch" and do {
+ $found++;
+ ($rhf, $roffset) = ($hf, $offset);
+ }
+ }), "Running traverse");
+
+ok($found == 1, "The previously installed rpm is found");
+ok($roffset > 0, "Retrieve offset db");
#ok($ts->transremove_pkg("test-rpm(1.0-1mdk)") == 1, "Try to remove a rpm");
ok($ts->transcheck() == 0, "Checking transaction works");
@@ -113,26 +113,26 @@ ok(!defined($ts->transreset()), "Reseting current transaction");
ok($ts->transorder() == 0, "Run transaction order");
ok($ts->transcheck() == 0, "Checking transaction works");
ok(defined($ts->transflag([qw(JUSTDB)])), "Set transflags");
-ok($ts->transrun([ qw(LABEL PERCENT) ]) == 0, "Running transaction justdb");
+#ok($ts->transrun([ qw(LABEL PERCENT) ]) == 0, "Running transaction justdb");
$found = 0;
-#ok($ts->traverse( sub {
-# my ($hf, $offset) = @_;
-# scalar($hf->fullname()) eq "test-rpm-1.0-1mdk.noarch" and do {
-# $found++;
-# ($rhf, $roffset) = ($hf, $offset);
-# }
-# }), "Running traverse");
-#
+ok($ts->traverse( sub {
+ my ($hf, $offset) = @_;
+ scalar($hf->fullname()) eq "test-rpm-1.0-1mdk.noarch" and do {
+ $found++;
+ ($rhf, $roffset) = ($hf, $offset);
+ }
+ }), "Running traverse");
+
#ok($found == 0, "The previously removed rpm is not found");
-#ok($ts->transadd($h, "test-rpm-1.0-1mdk.noarch.rpm", 1, "/usr", 1) == 0, "Adding a package to transaction with prefix");
+ok($ts->transadd($h, "test-rpm-1.0-1mdk.noarch.rpm", 1, "/usr", 1) == 0, "Adding a package to transaction with prefix");
ok($ts->transorder() == 0, "Run transaction order");
ok($ts->transcheck() == 0, "Checking transaction works");
ok(!defined($ts->transreset()), "Reseting current transaction");
-#ok($ts->transadd($h, "test-rpm-1.0-1mdk.noarch.rpm", 1, {"/etc" => "/usr" }, 1) == 0, "Adding a package to transaction with relocation works");
+ok($ts->transadd($h, "test-rpm-1.0-1mdk.noarch.rpm", 1, {"/etc" => "/usr" }, 1) == 0, "Adding a package to transaction with relocation works");
ok($ts->transorder() == 0, "Run transaction order");
ok($ts->transcheck() == 0, "Checking transaction works");
ok(!defined($ts->transreset()), "Reseting current transaction");