summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-30 12:58:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-30 12:58:41 +0000
commit971b99f3ed87560ad1523f1442ec0a842fa2606b (patch)
tree08670e23de5f980668ae3dc7421c2b062ff872cc /test
parent79e239cbd83ba7097c10fa939b813649f5a06cba (diff)
merge revision(s) 59033,59034: [Backport #13636]
rexml: add close tag check on end of document to StreamParser [ruby-core:81593] [Bug #13636] Reported by Anton Sivakov. Thanks!!! * properties. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rexml/parser/test_stream.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/rexml/parser/test_stream.rb b/test/rexml/parser/test_stream.rb
new file mode 100644
index 0000000000..c315833e4b
--- /dev/null
+++ b/test/rexml/parser/test_stream.rb
@@ -0,0 +1,32 @@
+require "test/unit"
+require "rexml/document"
+require "rexml/streamlistener"
+
+module REXMLTests
+ class TestStreamParser < Test::Unit::TestCase
+ class NullListener
+ include REXML::StreamListener
+ end
+
+ class TestInvalid < self
+ def test_no_end_tag
+ xml = "<root><sub>"
+ exception = assert_raise(REXML::ParseException) do
+ parse(xml)
+ end
+ assert_equal(<<-MESSAGE, exception.to_s)
+Missing end tag for '/root/sub'
+Line: 1
+Position: #{xml.bytesize}
+Last 80 unconsumed characters:
+ MESSAGE
+ end
+
+ private
+ def parse(xml, listener=nil)
+ listener ||= NullListener.new
+ REXML::Document.parse_stream(xml, listener)
+ end
+ end
+ end
+end