2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2011-09-07 10:42:44 -04:00
|
|
|
require "test/unit/testcase"
|
|
|
|
|
|
|
|
require 'rexml/document'
|
|
|
|
|
2014-05-27 08:07:40 -04:00
|
|
|
module REXMLTests
|
2011-09-07 10:42:44 -04:00
|
|
|
class CommentTester < Test::Unit::TestCase
|
|
|
|
# Bug #5278
|
|
|
|
def test_hyphen_end_line_in_doctype
|
|
|
|
xml = <<-XML
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!DOCTYPE root [
|
|
|
|
<!-- comment end with hyphen -
|
|
|
|
here -->
|
|
|
|
]>
|
|
|
|
<root/>
|
|
|
|
XML
|
|
|
|
document = REXML::Document.new(xml)
|
|
|
|
comments = document.doctype.children.find_all do |child|
|
|
|
|
child.is_a?(REXML::Comment)
|
|
|
|
end
|
|
|
|
assert_equal([" comment end with hyphen -\n here "],
|
|
|
|
comments.collect(&:to_s))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|