aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-04 06:53:57 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-04 06:53:57 +0000
commite440bfaed184b2fbbc37a838362a2f79280637cb (patch)
tree7d536cdc7acd7f6faac2b0e84fd75a1bc8acba2c /test/rexml
parent478d3dffa24a200dd595a7f50a58bb8ff3e1e0c0 (diff)
downloadruby-e440bfaed184b2fbbc37a838362a2f79280637cb.tar.gz
rexml: Fix a XPath bug of /child::node()
[Bug #14600] * lib/rexml/xpath_parser.rb: Fix a bug that "/child::node()" returns XML declaration and text nodes out of root element. * test/rexml/test_jaxen.rb: Enable more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_jaxen.rb27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 069a24e359..703b2793d0 100644
--- a/test/rexml/test_jaxen.rb
+++ b/test/rexml/test_jaxen.rb
@@ -21,8 +21,9 @@ module REXMLTests
def test_id ; process_test_case("id") ; end
def test_jaxen24 ; process_test_case("jaxen24") ; end
def test_lang ; process_test_case("lang") ; end
+ # document() function for XSLT isn't supported
def _test_message ; process_test_case("message") ; end
- def _test_moreover ; process_test_case("moreover") ; end
+ def test_moreover ; process_test_case("moreover") ; end
def _test_much_ado ; process_test_case("much_ado") ; end
def _test_namespaces ; process_test_case("namespaces") ; end
def _test_nitf ; process_test_case("nitf") ; end
@@ -80,13 +81,7 @@ module REXMLTests
xpath = value_of.attributes["select"]
matched = XPath.first(context, xpath, namespaces, variables)
- message = ""
- context.each_with_index do |node, i|
- message << "Node#{i}:\n"
- message << node.to_s
- end
- message << "XPath: <#{xpath}>\n"
- message << "Matched <#{matched.class}>"
+ message = user_message(context, xpath, matched)
if expected.nil?
assert_nil(matched, message)
@@ -117,11 +112,12 @@ module REXMLTests
expected = test.attributes["count"]
if expected
assert_equal(Integer(expected, 10),
- matched.size)
+ matched.size,
+ user_message(context, xpath, matched))
end
XPath.each(test, "valueOf") do |value_of|
- process_value_of(mathched, variables, namespaces, value_of)
+ process_value_of(matched, variables, namespaces, value_of)
end
end
@@ -132,5 +128,16 @@ module REXMLTests
XPath.match(context, select, namespaces, variables)
end
end
+
+ def user_message(context, xpath, matched)
+ message = ""
+ context.each_with_index do |node, i|
+ message << "Node#{i}:\n"
+ message << "#{node}\n"
+ end
+ message << "XPath: <#{xpath}>\n"
+ message << "Matched <#{matched}>"
+ message
+ end
end
end