summaryrefslogtreecommitdiff
path: root/test/rexml/test_attributes_mixin.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-17 13:14:14 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-17 13:14:14 +0000
commit91ed484f92040e5c2006a3a00ec77a54d552cf37 (patch)
tree03fd6677a85aaad516d0c9464b1273ea107231b7 /test/rexml/test_attributes_mixin.rb
parent045491d5be06b615d66d3f66cca2b5d2bc3c1929 (diff)
* test/rexml/: import REXML tests from
http://www.germane-software.com/repos/rexml/trunk/test/. Many tests are failed temporary. I'll fix them quickly. Sorry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_attributes_mixin.rb')
-rw-r--r--test/rexml/test_attributes_mixin.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/rexml/test_attributes_mixin.rb b/test/rexml/test_attributes_mixin.rb
new file mode 100644
index 0000000..44ab4f0
--- /dev/null
+++ b/test/rexml/test_attributes_mixin.rb
@@ -0,0 +1,34 @@
+#! /usr/local/bin/ruby
+
+
+require 'test/unit'
+require 'rexml/document'
+
+class TestAttributes < Test::Unit::TestCase
+
+ def setup
+ @ns_a = "urn:x-test:a"
+ @ns_b = "urn:x-test:b"
+ element_string = <<-"XMLEND"
+ <test xmlns:a="#{@ns_a}"
+ xmlns:b="#{@ns_b}"
+ a = "1"
+ b = '2'
+ a:c = "3"
+ a:d = '4'
+ a:e = "5"
+ b:f = "6"/>
+ XMLEND
+ @attributes = REXML::Document.new(element_string).root.attributes
+ end
+
+ def test_get_attribute_ns
+ assert_equal("1", @attributes.get_attribute_ns("", "a").value)
+ assert_equal("2", @attributes.get_attribute_ns("", "b").value)
+ assert_equal("3", @attributes.get_attribute_ns(@ns_a, "c").value)
+ assert_equal("4", @attributes.get_attribute_ns(@ns_a, "d").value)
+ assert_equal("5", @attributes.get_attribute_ns(@ns_a, "e").value)
+ assert_equal("6", @attributes.get_attribute_ns(@ns_b, "f").value)
+ end
+
+end