summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-06 07:40:53 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-06 07:40:53 +0200
commit84bc19fdf18ef3def54a60d364c1791fc19c4eb1 (patch)
tree4d125e98039fa60ac6709e61c1f2de8cbbc808ed
parentdd78ad345f868c9cd9702b6ecb8223415a6dbd27 (diff)
Add test for a few offline efa options
-rw-r--r--test/50-efa.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/50-efa.t b/test/50-efa.t
new file mode 100644
index 0000000..3239c02
--- /dev/null
+++ b/test/50-efa.t
@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+use Test::Command tests => 15;
+
+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+};
+
+# Usage on invalid invocation
+my $cmd = Test::Command->new(cmd => "$efa");
+
+$cmd->exit_isnt_num(0);
+$cmd->stdout_is_eq('');
+$cmd->stderr_like($re_usage);
+
+$cmd = Test::Command->new(cmd => "$efa E HBf MH");
+
+$cmd->exit_isnt_num(0);
+$cmd->stdout_is_eq('');
+$cmd->stderr_like($re_usage);
+
+# (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");
+
+# (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");
+
+# --version
+$cmd = Test::Command->new(cmd => "$efa --version");
+
+$cmd->exit_is_num(0);
+$cmd->stdout_like($re_version);
+$cmd->stderr_is_eq('');