From c082c1bb2bc0b0133e428a27c0e59ad830891bc8 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 5 Jun 2021 17:16:18 +0200 Subject: Split process_problems() for late reuse --- RPM4/t/05transaction.t | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'RPM4') diff --git a/RPM4/t/05transaction.t b/RPM4/t/05transaction.t index 4e10cea..070c918 100644 --- a/RPM4/t/05transaction.t +++ b/RPM4/t/05transaction.t @@ -42,21 +42,7 @@ ok($ts->transadd($hd, "$Bin/test-dep-1.0-1mdk.noarch.rpm") == 0, "Adding a packa ok($ts->transcheck == 0, "Checking transaction works"); ok($ts->transorder == 0, "Run transaction order"); -my $pbs = RPM4::Transaction::Problems->new($ts); -isa_ok( - $pbs, - 'RPM4::Transaction::Problems', - 'Can retrieve pb from transaction' -); - -ok($pbs->count, "Can get number of problems"); - -ok($pbs->init || 1, "Resetting problems counter"); -my $strpb; -while ($pbs->hasnext) { - $strpb .= $pbs->problem; -} -ok($strpb, "Can get problem description"); +process_problems(); ok(defined($ts->transflag([qw(TEST)])), "Set transflags"); #ok($ts->transrun([ qw(LABEL PERCENT) ]) == 0, "Running test transaction"); @@ -153,3 +139,21 @@ sub callback { my %a = @_; print STDERR "$a{what} $a{amount} / $a{total}\n"; } + +sub process_problems() { + my $pbs = RPM4::Transaction::Problems->new($ts); + isa_ok( + $pbs, + 'RPM4::Transaction::Problems', + 'Can retrieve pb from transaction' + ); + + ok($pbs->count, "Can get number of problems"); + + ok($pbs->init || 1, "Resetting problems counter"); + my $strpb; + while ($pbs->hasnext) { + $strpb .= $pbs->problem; + } + ok($strpb, "Can get problem description"); +} -- cgit v1.2.1