aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 13:56:34 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 13:56:34 +0000
commit562648e48ca42e6a263d52677638683add7327a6 (patch)
tree5d9ba26a7a991d781ee1ebf1b6b3e3954ab5314f /test/rexml
parentb486e50434df45d6e161eb359f576964a783e9e7 (diff)
downloadruby-562648e48ca42e6a263d52677638683add7327a6.tar.gz
* lib/rexml/element.rb (REXML::Attributes#to_a): Support
namespaced attributes. [ruby-dev:47277] [Bug #8301] Patch by Ippei Obayashi. Thanks!!! * test/rexml/test_attributes.rb (AttributesTester#test_to_a_with_namespaces): Add a test of the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_attributes.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/rexml/test_attributes.rb b/test/rexml/test_attributes.rb
index e46850de3a..f9c09876f7 100644
--- a/test/rexml/test_attributes.rb
+++ b/test/rexml/test_attributes.rb
@@ -195,4 +195,26 @@ class AttributesTester < Test::Unit::TestCase
doc.add_element 'a', { 'v' => 'x & y' }
assert doc.to_s.index(';')
end
+
+ def test_to_a_with_namespaces
+ document = Document.new(<<-XML)
+<root
+ xmlns:ns1="http://example.org/ns1"
+ xmlns:ns2="http://example.org/ns2">
+ <child
+ ns1:attribute="ns1"
+ ns2:attribute="ns2"
+ attribute="no-ns"
+ other-attribute="other-value"/>
+</root>
+XML
+ child = document.root.elements["child"]
+ assert_equal([
+ "attribute='no-ns'",
+ "ns1:attribute='ns1'",
+ "ns2:attribute='ns2'",
+ "other-attribute='other-value'",
+ ],
+ child.attributes.to_a.collect(&:to_string).sort)
+ end
end