diff options
Diffstat (limited to 'test/rexml/parse/test_element.rb')
-rw-r--r-- | test/rexml/parse/test_element.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/rexml/parse/test_element.rb b/test/rexml/parse/test_element.rb index aad915fe7b..7206fe595a 100644 --- a/test/rexml/parse/test_element.rb +++ b/test/rexml/parse/test_element.rb @@ -33,6 +33,32 @@ Last 80 unconsumed characters: DETAIL end + + def test_garbage_less_than_before_root_element_at_line_start + exception = assert_raise(REXML::ParseException) do + parse("<\n<x/>") + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +malformed XML: missing tag start +Line: 2 +Position: 6 +Last 80 unconsumed characters: +< <x/> + DETAIL + end + + def test_garbage_less_than_slash_before_end_tag_at_line_start + exception = assert_raise(REXML::ParseException) do + parse("<x></\n</x>") + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Missing end tag for 'x' +Line: 2 +Position: 10 +Last 80 unconsumed characters: +</ </x> + DETAIL + end end end end |