summaryrefslogtreecommitdiff
path: root/t/30-invalid-xml.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-11-21 10:44:27 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-11-21 10:48:33 +0100
commit4e5d250b7304994b98da342717c1c7acbea250d4 (patch)
tree1609d59fe19f0ffdbdfbeb29f9cbeb77ebd53747 /t/30-invalid-xml.t
parent220b3bf395fa4aa87a0b5b9c161ac6e59ba08d58 (diff)
Do not croak when receiving invalid XML
Diffstat (limited to 't/30-invalid-xml.t')
-rwxr-xr-xt/30-invalid-xml.t17
1 files changed, 14 insertions, 3 deletions
diff --git a/t/30-invalid-xml.t b/t/30-invalid-xml.t
index cb83a4c..4a358a2 100755
--- a/t/30-invalid-xml.t
+++ b/t/30-invalid-xml.t
@@ -6,7 +6,7 @@ use 5.020;
use utf8;
use File::Slurp qw(read_file);
-use Test::More tests => 1;
+use Test::More tests => 2;
use Travel::Status::DE::HAFAS;
@@ -15,7 +15,18 @@ my $xml = 'lol';
my $status = Travel::Status::DE::HAFAS->new(
service => 'DB',
station => 'Berlin Jannowitzbrücke',
- xml => $xml
+ xml => $xml
);
-is (scalar $status->results, 0, 'no results on invalid input');
+is( scalar $status->results,
+ 0, 'no results on valid XML with invalid HAFAS data' );
+
+$xml = 'lol<';
+
+$status = Travel::Status::DE::HAFAS->new(
+ service => 'DB',
+ station => 'Berlin Jannowitzbrücke',
+ xml => $xml
+);
+
+is( scalar $status->results, 0, 'no results on invalid XML' );