summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-21 14:49:44 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-21 14:49:44 +0100
commitc29f487ec8dda9b156ae924cc00cc6a72b31a495 (patch)
treef55b82961cb7ec4c03ef9f3b76a66ef948138d40
parent2c05b8fc1754ecf27a67f62971570da909e19b94 (diff)
add test cases for imaginary station and no results in timeframe
-rw-r--r--t/30-iris-const.t17
-rw-r--r--t/31-result-basics.t19
2 files changed, 34 insertions, 2 deletions
diff --git a/t/30-iris-const.t b/t/30-iris-const.t
index e82b59c..e8e60ae 100644
--- a/t/30-iris-const.t
+++ b/t/30-iris-const.t
@@ -4,7 +4,7 @@ use warnings;
use 5.014;
use DateTime;
-use Test::More tests => 4;
+use Test::More tests => 5;
use Test::Fatal;
use Travel::Status::DE::IRIS;
@@ -41,6 +41,21 @@ ok( defined $status->errstr, 'constructor with missing data has errstr' );
$status = Travel::Status::DE::IRIS->new(
iris_base => 'file:t/in',
+ station => 'doesnotexist',
+ datetime => DateTime->new(
+ year => 2014,
+ month => 1,
+ day => 3,
+ hour => 19,
+ minute => 1,
+ time_zone => 'Europe/Berlin'
+ )
+);
+
+ok( defined $status->errstr, 'constructor with imaginary station has errstr' );
+
+$status = Travel::Status::DE::IRIS->new(
+ iris_base => 'file:t/in',
station => 'EBILP',
datetime => DateTime->new(
year => 2014,
diff --git a/t/31-result-basics.t b/t/31-result-basics.t
index 206134c..9a76e91 100644
--- a/t/31-result-basics.t
+++ b/t/31-result-basics.t
@@ -5,7 +5,7 @@ use 5.014;
use utf8;
use DateTime;
-use Test::More tests => 434;
+use Test::More tests => 435;
use Test::Fatal;
use Travel::Status::DE::IRIS;
@@ -70,3 +70,20 @@ for my $i (0 .. $#results) {
is($r->destination, $r->route_end, "results[$i]: destination == routd_end");
is($r->train, $r->line, "results[$i]: line == train");
}
+
+$status = Travel::Status::DE::IRIS->new(
+ iris_base => 'file:t/in',
+ station => 'EE',
+ datetime => DateTime->new(
+ year => 2014,
+ month => 1,
+ day => 5,
+ hour => 20,
+ minute => 1,
+ time_zone => 'Europe/Berlin'
+ )
+);
+
+@results = $status->results;
+
+is(@results, 0, 'no data available -> empty result list');