summaryrefslogtreecommitdiff
path: root/test/rexml/parse/test_element.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-05 11:48:23 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-05 11:48:23 +0000
commit1b59a4dc76caa061355f4289d2c54d4625671735 (patch)
tree51ccf20baa839ba3c28955a4a81d9efbe4c0e86b /test/rexml/parse/test_element.rb
parent1a38986aedf63f676efded3e834c959059d21760 (diff)
REXML 3.1.9.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/parse/test_element.rb')
-rw-r--r--test/rexml/parse/test_element.rb26
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