mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00

-- * 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. -- * test/rexml/test_listener.rb: remove needless codes. -- * test/rexml/: fix fixture data path. All REXML tests are worked. -- * test/rexml/: untabify. -- * test/rexml/test_core.rb: enable. -- * test/rexml/test_sax.rb: don't use thread and sleep to avoid slow test. -- * lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb: add missing method availability check. [ruby-core:32447] Reported by Wiebe Cazemier. Thanks!!! -- Specify external encoding. When external encoding is not specified, it uses default external encoding. But it depends the environment. So specify as UTF-8 for environments whose locale is not UTF-8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
32 lines
930 B
Ruby
32 lines
930 B
Ruby
#! /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
|