summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-08-14 11:31:26 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-08-14 11:31:26 +0200
commit49bca5b7fafffc9dc42660fc13c7931cd243426d (patch)
tree1da91abf5633751d85bfecc063c55061921d4725
parentb9c18d6739b79a645a14df5bb51f24987a6ef308 (diff)
Remove 'time' option from WWW::Efa
-rw-r--r--lib/WWW/Efa.pm9
-rw-r--r--t/50-www-efa.t13
-rw-r--r--t/60-bin-efa.t14
3 files changed, 20 insertions, 16 deletions
diff --git a/lib/WWW/Efa.pm b/lib/WWW/Efa.pm
index 0716d5e..0aa2f46 100644
--- a/lib/WWW/Efa.pm
+++ b/lib/WWW/Efa.pm
@@ -53,7 +53,7 @@ sub post_time {
my ($post, $conf) = @_;
my $time;
- if ($conf->{'depart'} || $conf->{'time'}) {
+ if ($conf->{'depart'}) {
$post->{'itdTripDateTimeDepArr'} = 'dep';
$time = $conf->{'depart'} || $conf->{'time'};
}
@@ -64,7 +64,8 @@ sub post_time {
if ($time !~ / ^ [0-2]? \d : [0-5]? \d $ /x) {
die WWW::Efa::Error::Setup->new(
- 'time', $time, 'Must match HH:MM'
+ ($conf->{'depart'} ? 'depart' : 'arrive'),
+ $time, 'Must match HH:MM'
);
}
@{$post}{'itdTimeHour', 'itdTimeMinute'} = split(/:/, $time);
@@ -179,7 +180,7 @@ sub create_post {
if ($conf->{'via'}) {
post_place($post, 'via', @{$conf->{'via'}});
}
- if ($conf->{'arrive'} || $conf->{'depart'} || $conf->{'time'}) {
+ if ($conf->{'arrive'} || $conf->{'depart'}) {
post_time($post, $conf);
}
if ($conf->{'date'}) {
@@ -343,7 +344,7 @@ contain. See B<from> for arguments.
Sets the journey end time
-=item B<depart>|B<time> => I<HH:MM>
+=item B<depart> => I<HH:MM>
Sets the journey start time
diff --git a/t/50-www-efa.t b/t/50-www-efa.t
index bae1e94..8e56624 100644
--- a/t/50-www-efa.t
+++ b/t/50-www-efa.t
@@ -3,7 +3,7 @@ use strict;
use warnings;
use 5.010;
-use Test::More tests => 135;
+use Test::More tests => 131;
BEGIN {
use_ok('WWW::Efa');
@@ -116,13 +116,6 @@ is_efa_post(
);
is_efa_post(
- 'time', '22:23',
- ['itdTripDateTimeDepArr', 'dep'],
- ['itdTimeHour', '22'],
- ['itdTimeMinute', '23'],
-);
-
-is_efa_post(
'depart', '22:23',
['itdTripDateTimeDepArr', 'dep'],
['itdTimeHour', '22'],
@@ -137,12 +130,12 @@ is_efa_post(
);
is_efa_err(
- 'time', '37:00',
+ 'depart', '37:00',
'Must match HH:MM',
);
is_efa_err(
- 'time', '07',
+ 'depart', '07',
'Must match HH:MM',
);
diff --git a/t/60-bin-efa.t b/t/60-bin-efa.t
index 2b60233..0ae0b1f 100644
--- a/t/60-bin-efa.t
+++ b/t/60-bin-efa.t
@@ -94,13 +94,23 @@ for my $opt (qw/-w --walk-speed/) {
);
}
-for my $opt (qw/-t --time --depart -a --arrive/) {
+for my $opt (qw/-t --time --depart/) {
$cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq(
- mk_err('time', '35:12', 'Must match HH:MM')
+ mk_err('depart', '35:12', 'Must match HH:MM')
+ );
+}
+
+for my $opt (qw/-a --arrive/) {
+ $cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg");
+
+ $cmd->exit_isnt_num(0);
+ $cmd->stdout_is_eq($EMPTY);
+ $cmd->stderr_is_eq(
+ mk_err('arrive', '35:12', 'Must match HH:MM')
);
}