ruby-changes:21161
From: kou <ko1@a...>
Date: Wed, 7 Sep 2011 23:43:05 +0900 (JST)
Subject: [ruby-changes:21161] kou:r33210 (trunk): * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb:
kou 2011-09-07 23:42:44 +0900 (Wed, 07 Sep 2011) New Revision: 33210 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33210 Log: * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb: allow a single hyphen in comment. [Bug 5278] Reported by Thomas Fritzsche. Thanks!!! Added files: trunk/test/rexml/test_comment.rb Modified files: trunk/ChangeLog trunk/lib/rexml/parsers/baseparser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33209) +++ ChangeLog (revision 33210) @@ -1,3 +1,9 @@ +Wed Sep 7 23:41:24 2011 Kouhei Sutou <kou@c...> + + * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb: + allow a single hyphen in comment. [Bug 5278] + Reported by Thomas Fritzsche. Thanks!!! + Wed Sep 7 17:27:18 2011 NARUSE, Yui <naruse@r...> * lib/yaml.rb: explicitly specify ::Object to avoid the collision with Index: lib/rexml/parsers/baseparser.rb =================================================================== --- lib/rexml/parsers/baseparser.rb (revision 33209) +++ lib/rexml/parsers/baseparser.rb (revision 33210) @@ -346,7 +346,7 @@ md = @source.match( COMMENT_PATTERN, true ) case md[1] - when /--/, /-$/ + when /--/, /-\z/ raise REXML::ParseException.new("Malformed comment", @source) end Index: test/rexml/test_comment.rb =================================================================== --- test/rexml/test_comment.rb (revision 0) +++ test/rexml/test_comment.rb (revision 33210) @@ -0,0 +1,25 @@ +require "test/unit/testcase" + +require 'rexml/document' + +module REXMLTest + 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 Property changes on: test/rexml/test_comment.rb ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/