diff --git a/bin/efa b/bin/efa index 0670083601ae89eac89860fb65cd536e0cf26124..4a7f6ebb9f0fcbd3da23921160c8722a46a8d5a6 100755 --- a/bin/efa +++ b/bin/efa @@ -50,6 +50,24 @@ sub check_ambiguous { } } +sub check_no_connections { + my ($full_tree) = @_; + + my $xp_err_img = XML::LibXML::XPathExpression->new( + '//td/img[@src="images/ausrufezeichen.jpg"]'); + + my $err_node = $full_tree->findnodes($xp_err_img)->[0]; + + if ($err_node) { + say "Looks like efa.vrr.de showed an error."; + say "I will now try to dump the error message:"; + + say $err_node->parentNode()->parentNode()->textContent(); + + exit 2; + } +} + sub display_connection { my ($con_parts) = @_; @@ -340,6 +358,7 @@ if ($test_dump) { my $tree = XML::LibXML->load_html(string => $content); check_ambiguous($tree); +check_no_connections($tree); $connections = parse_tree($tree); diff --git a/test/50-efa.t b/test/50-efa.t index 1425696f406207db3b2ce0ea411a204997bc9e62..067b70b739f126819a5809fada4763f153cd46d7 100644 --- a/test/50-efa.t +++ b/test/50-efa.t @@ -3,7 +3,7 @@ use strict; use warnings; use 5.010; -use Test::Command tests => 79; +use Test::Command tests => 82; my $efa = 'bin/efa'; my $testarg = "E HBf MH HBf"; @@ -144,3 +144,11 @@ $cmd = Test::Command->new( $cmd->exit_is_num(1); $cmd->stdout_is_file('test/parse_ambiguous'); $cmd->stderr_is_eq($EMPTY); + +$cmd = Test::Command->new( + cmd => "$efa $test_parse < test/dump_no_connections" +); + +$cmd->exit_is_num(2); +$cmd->stdout_is_file('test/parse_no_connections'); +$cmd->stderr_is_eq($EMPTY); diff --git a/test/dump_no_connections b/test/dump_no_connections new file mode 100644 index 0000000000000000000000000000000000000000..bc6c48135e2f1ab4df1ab503d70e5c42ab59acc7 --- /dev/null +++ b/test/dump_no_connections @@ -0,0 +1,855 @@ + +
+ +