summaryrefslogtreecommitdiff
path: root/t/20-vrr.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-11 20:25:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-11 20:25:17 +0200
commit0640f90da6e16a23fc87dd4acb32d1d3604b1267 (patch)
treef60861c94016a813c86b693443fa543a278bd575 /t/20-vrr.t
parent50a12ddf7f67f7a7e383fe0e1962e41c24afce02 (diff)
Add actual tests
Diffstat (limited to 't/20-vrr.t')
-rw-r--r--t/20-vrr.t29
1 files changed, 28 insertions, 1 deletions
diff --git a/t/20-vrr.t b/t/20-vrr.t
index 5b5b499..da2a1ba 100644
--- a/t/20-vrr.t
+++ b/t/20-vrr.t
@@ -3,9 +3,36 @@ use strict;
use warnings;
use 5.010;
-use Test::More tests => 2;
+use File::Slurp qw(slurp);
+use Test::More tests => 94;
BEGIN {
use_ok('Travel::Status::DE::VRR');
}
require_ok('Travel::Status::DE::VRR');
+
+my $html = slurp('t/in/essen_bp.html');
+
+my $status = Travel::Status::DE::VRR->new_from_html(html => $html);
+
+isa_ok($status, 'Travel::Status::DE::VRR');
+can_ok($status, qw(errstr results));
+
+my @results = $status->results;
+
+for my $result (@results) {
+ isa_ok($result, 'Travel::Status::DE::VRR::Result');
+ can_ok($result, qw(destination info line time platform));
+}
+
+is($results[0]->destination, 'Essen Wertstr.', 'first result: destination ok');
+is($results[0]->info, q{}, 'first result: no info');
+is($results[0]->line, '103', 'first result: line ok');
+is($results[0]->time, '20:19', 'first result: time ok');
+is($results[0]->platform, 'Bstg. 1', 'first result: platform ok');
+
+is($results[-1]->destination, 'Essen Germaniaplatz', 'last result: destination ok');
+is($results[-1]->info, q{}, 'last result: no info');
+is($results[-1]->line, '101', 'last result: line ok');
+is($results[-1]->time, '21:07', 'last result: time ok');
+is($results[-1]->platform, 'Bstg. 1', 'last result: platform ok');