summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-23 14:58:41 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-23 14:58:41 +0100
commit957026b07dad416e26a51b30d168794b17e5e39f (patch)
tree1d2324e26b9cdc5ff915a0b84e2f3968234c9cbd
parent8f6b0fc0931752acedee232f327b93ba45632062 (diff)
add basic ::Result tests
-rw-r--r--Changelog4
-rw-r--r--t/23-results.t39
2 files changed, 43 insertions, 0 deletions
diff --git a/Changelog b/Changelog
index f5e163f..54b3a33 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+git HEAD
+
+ * Travel::Status::DE::URE::Result: Fix countdown_sec accessor
+
Travel::Status::DE::URA 0.02 - Thu Dec 26 2013
* aseag-m: Fix spaces in stop names (they didn't match anything)
diff --git a/t/23-results.t b/t/23-results.t
new file mode 100644
index 0000000..05f3946
--- /dev/null
+++ b/t/23-results.t
@@ -0,0 +1,39 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+use utf8;
+
+use List::Util qw(first);
+use Test::More tests => 7;
+
+BEGIN {
+ use_ok('Travel::Status::DE::URA');
+}
+require_ok('Travel::Status::DE::URA');
+
+my ($s, @results);
+
+$s = Travel::Status::DE::URA->new(
+ ura_base => 'file:t/in',
+ ura_version => 1,
+ datetime => DateTime->new(
+ year => 2013,
+ month => 12,
+ day => 23,
+ hour => 12,
+ minute => 42,
+ time_zone => 'Europe/Berlin'
+ ),
+ hide_past => 0,
+);
+
+@results = $s->results;
+
+# results[0]: "Kohlscheid Bahnhof","210717","34","34",1,"Kohlscheid Bahnhof","586"
+
+is($results[0]->countdown, 2, '->countdown: 2');
+is($results[0]->countdown_sec, 120, '->countdown_sec with sec 0 -> sec 0 : 120');
+is($results[0]->date, '23.12.2013', '->date');
+isa_ok($results[0]->datetime, 'DateTime', '->datetime is DateTime');
+is($results[0]->time, '12:44:00', '->time');