[debsums] 01/02: Add check for --version and --help options

Axel Beckert abe at deuxchevaux.org
Thu Mar 26 02:05:54 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 9ccbd81766e83f1148095c13fc91617a692b51cf
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Thu Mar 26 02:43:23 2015 +0100

    Add check for --version and --help options
    
    This also covers regressions from #779626.
---
 t/version-and-help.t | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/t/version-and-help.t b/t/version-and-help.t
new file mode 100644
index 0000000..4c38e49
--- /dev/null
+++ b/t/version-and-help.t
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -T
+
+# Simple test for additional debsums command-line options
+
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Command::Simple;
+
+my $command;
+my $chroot;
+my @command;
+
+# Untaint stuff
+delete $ENV{PATH};
+
+# First check if we are testing a source package (debsums in current
+# directory) or an installed package (full path).
+foreach my $cmd (qw(./debsums /usr/bin/debsums)) {
+    if (-x $cmd) {
+        $command = $cmd;
+        last;
+    }
+}
+ok($command, "Command debsums found at $command");
+
+run($command, '--version');
+is(stderr, '', 'STDERR is empty');
+# This actually also checks for regressions with regards to #779626.
+like(stdout, qr/^debsums \d.\d/, 'Version number is shown');
+is(rc >> 8, 0, 'Exit code is 0');
+
+run($command, '--help');
+is(stderr, '', 'STDERR is empty');
+like(stdout, qr/^Usage: /m, 'Usage message');
+is(rc >> 8, 0, 'Exit code is 0');
+
+done_testing();

-- 
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