From 957026b07dad416e26a51b30d168794b17e5e39f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 23 Jan 2014 14:58:41 +0100 Subject: add basic ::Result tests --- Changelog | 4 ++++ t/23-results.t | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 t/23-results.t 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'); -- cgit v1.2.3