HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.2.10/test/rexml/test_comment.rb
require "test/unit/testcase"

require 'rexml/document'

module REXMLTests
  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