summaryrefslogtreecommitdiff
path: root/test/50-efa.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-11 16:24:35 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-11 16:24:35 +0200
commitf7b3a08ca0067a70f65cb420f70851ee7ddaba50 (patch)
treed5cfbc67565154c1e7d4a9fa95220cdf31a8feea /test/50-efa.t
parenta41dbb97fc2b584a0c6f58961f94024782e47577 (diff)
Add tests for some more options
Diffstat (limited to 'test/50-efa.t')
-rw-r--r--test/50-efa.t47
1 files changed, 43 insertions, 4 deletions
diff --git a/test/50-efa.t b/test/50-efa.t
index 3239c02..79ed907 100644
--- a/test/50-efa.t
+++ b/test/50-efa.t
@@ -2,14 +2,23 @@
use strict;
use warnings;
use 5.010;
-use Test::Command tests => 15;
+use Test::Command tests => 30;
-my $efa = 'bin/efa';
+my $efa = 'bin/efa';
my $testarg = "E HBf MH HBf";
my $re_usage = qr{Insufficient to/from arguments, see \S*efa --help for usage};
my $re_version = qr{\S*efa version \S+};
+my $err_exclude = "Invalid argument. See manpage for --exclude usage\n";
+my $err_prefer = "Invalid argument. Usage: --prefer speed|nowait|nowalk\n";
+my $err_include = "Invalid argument. Usage: --include local|ic|ice\n";
+my $err_time = "Invalid argument. Usage: --time HH:MM\n";
+my $err_date = "Invalid argument: Usage: --date DD.MM[.YYYY]\n";
+
+my $err_walk_speed
+ = "Invalid argument. Uaseg: --walk-speed normal|fast|slow\n";
+
# Usage on invalid invocation
my $cmd = Test::Command->new(cmd => "$efa");
@@ -23,19 +32,49 @@ $cmd->exit_isnt_num(0);
$cmd->stdout_is_eq('');
$cmd->stderr_like($re_usage);
+$cmd = Test::Command->new(cmd => "$efa E HBf Du HBf MH");
+
+$cmd->exit_isnt_num(0);
+$cmd->stdout_is_eq('');
+$cmd->stderr_like($re_usage);
+
+$cmd = Test::Command->new(cmd => "$efa --exclude invalid $testarg");
+
+$cmd->exit_isnt_num(0);
+$cmd->stdout_is_eq('');
+$cmd->stderr_is_eq($err_exclude);
+
+$cmd = Test::Command->new(cmd => "$efa --prefer invalid $testarg");
+
+$cmd->exit_isnt_num(0);
+$cmd->stdout_is_eq('');
+$cmd->stderr_is_eq($err_prefer);
+
+$cmd = Test::Command->new(cmd => "$efa --include invalid $testarg");
+
+$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");
+
+$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");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq("Invalid argument. Usage: --time HH:MM\n");
+$cmd->stderr_is_eq($err_time);
# (primitive) argument checking for --date
$cmd = Test::Command->new(cmd => "$efa --date 11.23.2010 $testarg");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq('');
-$cmd->stderr_is_eq("Invalid argument: Usage: --date DD.MM[.YYYY]\n");
+$cmd->stderr_is_eq($err_date);
# --version
$cmd = Test::Command->new(cmd => "$efa --version");