Abort with an error if no files are given.
authorSimon Ruderich <simon@ruderich.org>
Mon, 9 Apr 2012 21:27:31 +0000 (23:27 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 9 Apr 2012 21:27:31 +0000 (23:27 +0200)
bin/blhc
t/tests.t

index 0fbf4c9a2de11c12192b184cdb749a2e36152c25..835e9e04e344cea2d96ffe44f5a4fc032343eb83 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -441,7 +441,8 @@ 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);
 }
index 7fc4f9e534a11f8ab724623fd1577808de1ce9ed..95a8f40c830c43588b7686aab209851a4b35fac0 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 110;
+use Test::More tests => 112;
 
 
 sub is_blhc {
@@ -31,7 +31,8 @@ sub is_blhc {
         $file = "@{$file}";
     }
 
-    my $output = `./bin/blhc $options ./t/logs/$file 2>&1`;
+    $file = "./t/logs/$file" if $file;
+    my $output = `./bin/blhc $options $file 2>&1`;
 
     if ($options) {
         $options = ' '. $options;
@@ -43,13 +44,17 @@ sub is_blhc {
 
 # Usage.
 
-is_blhc 'empty', '--invalid', 2,
-        'Unknown option: invalid
-Usage:
+my $usage =
+        'Usage:
     blhc [*options*] *<dpkg-buildpackage build log file>..*
 
 ';
+is_blhc '', '--invalid', 2,
+        "Unknown option: invalid\n"
+        . $usage;
 
+is_blhc '', '', 2,
+        $usage;
 
 # No compiler commands found.