From 93540e07ace91544bd5e72f509d6b83744d98e07 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 28 Apr 2012 10:51:46 +0200 Subject: [PATCH] Fix --help, --version. Broken in c2dd74aada8d92258b14727c057e5d02a4c8c7a4. --- bin/blhc | 9 +++++++-- t/tests.t | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/bin/blhc b/bin/blhc index 12b7eab..b0ab4a6 100755 --- a/bin/blhc +++ b/bin/blhc @@ -449,8 +449,7 @@ if (not Getopt::Long::GetOptions( 'color' => \$option_color, 'arch=s' => \$option_arch, 'buildd' => \$option_buildd, - ) - or scalar @ARGV == 0) { + )) { require Pod::Usage; Pod::Usage::pod2usage(2); } @@ -477,6 +476,12 @@ along with this program. If not, see . exit 0; } +# Arguments missing. +if (scalar @ARGV == 0) { + require Pod::Usage; + Pod::Usage::pod2usage(2); +} + # Don't load Term::ANSIColor in buildd mode because Term::ANSIColor is not # installed on Debian's buildds. if (not $option_buildd) { diff --git a/t/tests.t b/t/tests.t index 21fca07..a1b8012 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,7 +19,7 @@ use strict; use warnings; -use Test::More tests => 136; +use Test::More tests => 138; sub is_blhc { @@ -56,6 +56,23 @@ is_blhc '', '--invalid', 2, is_blhc '', '', 2, $usage; +is_blhc '', '--version', 0, + 'blhc 0.01 Copyright (C) 2012 Simon Ruderich + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +'; + # No compiler commands found. -- 2.43.2