summaryrefslogtreecommitdiff
path: root/test/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:41:26 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:41:26 +0000
commit69eedf6a18d0c21b06d30ec4bc4a550d4ac125dd (patch)
tree66d0a13000e00d69d5ab64598d99f4230a43fa88 /test/rexml
parentc032c5bc9acb015dbe2947a39d3d7ce033c934ee (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_xml_declaration.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/rexml/test_xml_declaration.rb b/test/rexml/test_xml_declaration.rb
index d58f9f0..16427c7 100644
--- a/test/rexml/test_xml_declaration.rb
+++ b/test/rexml/test_xml_declaration.rb
@@ -31,4 +31,16 @@ class TestXmlDeclaration < Test::Unit::TestCase
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