[debsums] 02/06: Further refactoring of the checks to reduce code duplication

Axel Beckert abe at deuxchevaux.org
Thu Mar 26 00:53:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository debsums.

commit 9da7f08e84d4c932a053867797aaae1fd8a65aeb
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Thu Mar 26 01:28:59 2015 +0100

    Further refactoring of the checks to reduce code duplication
---
 t/debsums.t | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/t/debsums.t b/t/debsums.t
index 0463e2a..5be9f21 100644
--- a/t/debsums.t
+++ b/t/debsums.t
@@ -49,7 +49,7 @@ EOT
         run(@command);
         is(stderr, '', 'STDERR is empty');
         is(stdout, $expected, 'STDOUT as expected');
-        is(rc >> 8, $exit_code, "Exit code is $exit_code");
+        expected_rc($exit_code);
 
         # Test option -c
         run(@command, '-c');
@@ -58,7 +58,7 @@ EOT
            $state eq 'clean' ? '' :
            "$chroot/usr/share/doc/fakepkg/README\n",
            'STDOUT as expected');
-        is(rc >> 8, $exit_code, "Exit code is $exit_code");
+        expected_rc($exit_code);
 
         # Test option -e
         run(@command);
@@ -66,7 +66,7 @@ EOT
         is(sort_lines(stdout),
            sort_lines($expected_conffiles),
            'STDOUT as expected');
-        is(rc >> 8, $exit_code, "Exit code is $exit_code");
+        expected_rc($exit_code);
 
         # Test option -ce and variants
         foreach my $option (qw(-ce -ec)) {
@@ -76,7 +76,7 @@ EOT
                $state eq 'clean' ? '' :
                "$chroot/etc/fakepkg-broken.cfg\n",
                'STDOUT as expected');
-            is(rc >> 8, $exit_code, "Exit code is $exit_code");
+            expected_rc($exit_code);
         }
     }
 }
@@ -94,3 +94,8 @@ sub remove_failed {
     return join("\n", grep { !/FAILED/ } split("\n", $string)).
         ($string =~ m/\n\z/ ? "\n" : '');
 }
+
+sub expected_rc {
+    my $exit_code = shift;
+    is(rc >> 8, $exit_code, "Exit code is $exit_code");
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git



More information about the Pkg-perl-cvs-commits mailing list