summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-11 16:31:02 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-11 16:31:02 +0200
commit1c1cd84f9ab59809ad3e8e8ed12c8832ff6a33fa (patch)
tree9c5c85cb9fd54cbc51709d6ebe21265f5552fb9e /test
parentf7b3a08ca0067a70f65cb420f70851ee7ddaba50 (diff)
Add tests for short options
Diffstat (limited to 'test')
-rw-r--r--test/50-efa.t65
1 files changed, 37 insertions, 28 deletions
diff --git a/test/50-efa.t b/test/50-efa.t
index 79ed907..418e17e 100644
--- a/test/50-efa.t
+++ b/test/50-efa.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.010;
-use Test::Command tests => 30;
+use Test::Command tests => 48;
my $efa = 'bin/efa';
my $testarg = "E HBf MH HBf";
@@ -38,45 +38,54 @@ $cmd->exit_isnt_num(0);
$cmd->stdout_is_eq('');
$cmd->stderr_like($re_usage);
-$cmd = Test::Command->new(cmd => "$efa --exclude invalid $testarg");
+for my $opt (qw/-e --exclude/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt invalid $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_exclude);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_exclude);
+}
-$cmd = Test::Command->new(cmd => "$efa --prefer invalid $testarg");
+for my $opt (qw/-P --prefer/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt invalid $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_prefer);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_prefer);
+}
-$cmd = Test::Command->new(cmd => "$efa --include invalid $testarg");
+for my $opt (qw/-i --include/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt invalid $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_include);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_include);
+}
-$cmd = Test::Command->new(cmd => "$efa --walk-speed invalid $testarg");
+for my $opt (qw/-w --walk-speed/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt invalid $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_walk_speed);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_walk_speed);
+}
-# (primitive) argument checking for --time
-$cmd = Test::Command->new(cmd => "$efa --time 35:12 $testarg");
+for my $opt (qw/-t --time/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_time);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_time);
+}
-# (primitive) argument checking for --date
-$cmd = Test::Command->new(cmd => "$efa --date 11.23.2010 $testarg");
+for my $opt (qw/-d --date/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt 11.23.2010 $testarg");
-$cmd->exit_isnt_num(0);
-$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq($err_date);
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq('');
+ $cmd->stderr_is_eq($err_date);
+}
-# --version
$cmd = Test::Command->new(cmd => "$efa --version");
$cmd->exit_is_num(0);