diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-06 13:57:56 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-06 13:57:56 +0000 |
commit | b23eac6958ee2792d6fe60a31e8c636363e184d9 (patch) | |
tree | 3d8271eca935ac631a90ff961f9131021e5da3f4 /test | |
parent | d71b5394ac82943a7313d01d8880bb022f4d2871 (diff) | |
download | ruby-b23eac6958ee2792d6fe60a31e8c636363e184d9.tar.gz |
rexml: REXML::Element#[] accepts String or Symbol as attribute name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/rexml/test_element.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/rexml/test_element.rb b/test/rexml/test_element.rb new file mode 100644 index 0000000000..82830b44e6 --- /dev/null +++ b/test/rexml/test_element.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: false + +require "test/unit/testcase" +require "rexml/document" + +module REXMLTests + class ElementTester < Test::Unit::TestCase + def test_array_reference_string + doc = REXML::Document.new("<language name='Ruby'/>") + assert_equal("Ruby", doc.root["name"]) + end + + def test_array_reference_symbol + doc = REXML::Document.new("<language name='Ruby'/>") + assert_equal("Ruby", doc.root[:name]) + end + end +end |