ruby-changes:25389
From: kou <ko1@a...>
Date: Sat, 3 Nov 2012 13:46:25 +0900 (JST)
Subject: [ruby-changes:25389] kou:r37446 (trunk): Revert r37439 and r37441
kou 2012-11-03 13:46:06 +0900 (Sat, 03 Nov 2012) New Revision: 37446 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37446 Log: Revert r37439 and r37441 r37439: * lib/rexml/xmldecl.rb (REXML::XMLDecl): Stop using REXML::Encoding module because XMLDecl doesn't convert encoding. This causes removing XML encoding name normalization (encoding.upcase). Encoding name in XML declaration is what user specifies. I think this is reasonable change. * test/rexml/test_xml_declaration.rb: Add tests for the above change. r37441: * test/rexml/test_core.rb (Tester#test_ticket_88): Follow the change that encoding name in XML declaration isn't normalized. Modified directories: trunk/test/dl/ Modified files: trunk/ChangeLog trunk/doc/NEWS-1.8.7 trunk/doc/NEWS-1.9.1 trunk/enc/gb2312.c trunk/ext/pathname/lib/pathname.rb trunk/lib/rexml/xmldecl.rb trunk/template/encdb.h.tmpl trunk/template/transdb.h.tmpl trunk/test/open-uri/test_open-uri.rb trunk/test/rexml/test_core.rb trunk/test/rexml/test_xml_declaration.rb trunk/test/ruby/test_syntax.rb trunk/test/test_syslog.rb Property changes on: doc/NEWS-1.9.1 ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: doc/NEWS-1.8.7 ___________________________________________________________________ Deleted: svn:mergeinfo Index: ChangeLog =================================================================== --- ChangeLog (revision 37445) +++ ChangeLog (revision 37446) @@ -10,11 +10,6 @@ Fix a test that expects encoding in XML declaration is changed by Output's encoding. It is dropped feature. -Sat Nov 3 12:54:13 2012 Kouhei Sutou <kou@c...> - - * test/rexml/test_core.rb (Tester#test_ticket_88): Follow the - change that encoding name in XML declaration isn't normalized. - Sat Nov 3 12:49:45 2012 Kouhei Sutou <kou@c...> * lib/rexml/document.rb (REXML::Document#write): Document encoding @@ -25,15 +20,6 @@ encoding. * test/rexml/test_document.rb: Update tests for the above change. -Sat Nov 3 12:36:35 2012 Kouhei Sutou <kou@c...> - - * lib/rexml/xmldecl.rb (REXML::XMLDecl): Stop using REXML::Encoding - module because XMLDecl doesn't convert encoding. This causes - removing XML encoding name normalization (encoding.upcase). - Encoding name in XML declaration is what user specifies. - I think this is reasonable change. - * test/rexml/test_xml_declaration.rb: Add tests for the above change. - Sat Nov 3 12:18:35 2012 Masaki Matsushita <glass.saga@g...> * array.c (recursive_equal): fix not to make invalid pointers when Property changes on: enc/gb2312.c ___________________________________________________________________ Deleted: svn:mergeinfo Index: lib/rexml/xmldecl.rb =================================================================== --- lib/rexml/xmldecl.rb (revision 37445) +++ lib/rexml/xmldecl.rb (revision 37446) @@ -4,6 +4,8 @@ module REXML # NEEDS DOCUMENTATION class XMLDecl < Child + include Encoding + DEFAULT_VERSION = "1.0"; DEFAULT_ENCODING = "UTF-8"; DEFAULT_STANDALONE = "no"; @@ -11,7 +13,7 @@ STOP = '\?>'; attr_accessor :version, :standalone - attr_reader :encoding, :writeencoding, :writethis + attr_reader :writeencoding, :writethis def initialize(version=DEFAULT_VERSION, encoding=nil, standalone=nil) @writethis = true @@ -51,7 +53,7 @@ def ==( other ) other.kind_of?(XMLDecl) and other.version == @version and - other.encoding.upcase == self.encoding.upcase and + other.encoding == self.encoding and other.standalone == @standalone end @@ -66,13 +68,14 @@ end alias :stand_alone? :standalone + alias :old_enc= :encoding= def encoding=( enc ) if enc.nil? - @encoding = "UTF-8" + self.old_enc = "UTF-8" @writeencoding = false else - @encoding = enc + self.old_enc = enc @writeencoding = true end self.dowrite Property changes on: ext/pathname/lib/pathname.rb ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: test/ruby/test_syntax.rb ___________________________________________________________________ Deleted: svn:mergeinfo Index: test/rexml/test_core.rb =================================================================== --- test/rexml/test_core.rb (revision 37445) +++ test/rexml/test_core.rb (revision 37446) @@ -1312,9 +1312,9 @@ def test_ticket_88 doc = REXML::Document.new("<?xml version=\"1.0\" encoding=\"shift_jis\"?>") - assert_equal("<?xml version='1.0' encoding='shift_jis'?>", doc.to_s) + assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s) doc = REXML::Document.new("<?xml version = \"1.0\" encoding = \"shift_jis\"?>") - assert_equal("<?xml version='1.0' encoding='shift_jis'?>", doc.to_s) + assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s) end def test_ticket_85 Index: test/rexml/test_xml_declaration.rb =================================================================== --- test/rexml/test_xml_declaration.rb (revision 37445) +++ test/rexml/test_xml_declaration.rb (revision 37446) @@ -31,16 +31,4 @@ assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling) assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling) end - - def test_equal - lower_encoding_xml_decl = REXML::XMLDecl.new("1.0", "utf-8") - upper_encoding_xml_decl = REXML::XMLDecl.new("1.0", "UTF-8") - assert_equal(lower_encoding_xml_decl, upper_encoding_xml_decl) - end - - def test_encoding_is_not_normalized - lower_encoding_xml_decl = REXML::XMLDecl.new("1.0", "utf-8") - assert_equal("<?xml version='1.0' encoding='utf-8'?>", - lower_encoding_xml_decl.to_s) - end end Property changes on: test/test_syslog.rb ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: test/open-uri/test_open-uri.rb ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: test/dl ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: template/transdb.h.tmpl ___________________________________________________________________ Deleted: svn:mergeinfo Property changes on: template/encdb.h.tmpl ___________________________________________________________________ Deleted: svn:mergeinfo -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/