diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-01-20 13:41:53 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-01-20 13:41:53 +0100 |
commit | 6e7e2d798651560c940e58f68d8d7fb79d18670b (patch) | |
tree | bf611c5094010504bc055e0bdf86b1e02886d072 | |
parent | d47a165b3463fd3d52e5a05a821b7a8fd16f45ec (diff) |
route_interesting: Do not include the destination in the route in some cases
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 3 | ||||
-rw-r--r-- | t/33_result-route.t | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 0438722..042637a 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -302,6 +302,9 @@ sub route_interesting { if ( @via_main and $via_main[-1] eq $last_stop ) { pop(@via_main); } + if ( @via and $via[-1] eq $last_stop ) { + pop(@via); + } if ( @via_main and @via and $via[0] eq $via_main[0] ) { shift(@via_main); diff --git a/t/33_result-route.t b/t/33_result-route.t index 08c096d..3cc4ea2 100644 --- a/t/33_result-route.t +++ b/t/33_result-route.t @@ -5,7 +5,7 @@ use 5.014; use utf8; use DateTime; -use Test::More tests => 8; +use Test::More tests => 10; use Test::Fatal; use Travel::Status::DE::IRIS; @@ -95,5 +95,9 @@ is_deeply( is_deeply([$ice645->route_interesting], ['Bochum', 'Dortmund', 'Bielefeld'], 'route_interesting with just major'); +is_deeply([$s1->route_interesting], + [], 'route_interesting with realtime'); +is_deeply([$s9->route_interesting], + [], 'route_interesting, train ends here'); is_deeply([$abr->route_interesting], ['Essen-Kray Süd', 'Bochum', 'Witten'], 'route_interesting with minor'); |