summaryrefslogtreecommitdiff
path: root/test/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-21 06:39:43 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-21 06:39:43 +0000
commit6793c0a2270e4ec8ccc7450f66a3dc356e44f5b8 (patch)
tree8c1000de28607426e296ccec7428f101e9d48796 /test/rexml
parente044924ee508e87c07df1385f3dfddb739b7faaa (diff)
rexml: Fix XPath string() implementation
* lib/rexml/functions.rb( REXML::Functions.string): * Support context node. * Fix implementation for document node to remove out of root nodes. * Support processing instruction node. * Improve implementation for integer to omit decimals. * test/rexml/test_jaxen.rb: Enable processing instruction test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_jaxen.rb27
1 files changed, 5 insertions, 22 deletions
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 69c74d5572..671c185ea5 100644
--- a/test/rexml/test_jaxen.rb
+++ b/test/rexml/test_jaxen.rb
@@ -28,7 +28,7 @@ module REXMLTests
def _test_namespaces ; process_test_case("namespaces") ; end
def _test_nitf ; process_test_case("nitf") ; end
def _test_numbers ; process_test_case("numbers") ; end
- def _test_pi ; process_test_case("pi") ; end
+ def test_pi ; process_test_case("pi") ; end
def _test_pi2 ; process_test_case("pi2") ; end
def _test_simple ; process_test_case("simple") ; end
def _test_testNamespaces ; process_test_case("testNamespaces") ; end
@@ -79,29 +79,12 @@ module REXMLTests
def process_value_of(context, variables, namespaces, value_of)
expected = value_of.text
xpath = value_of.attributes["select"]
- matched = XPath.first(context, xpath, namespaces, variables)
+ matched = XPath.match(context, xpath, namespaces, variables)
message = user_message(context, xpath, matched)
-
- if expected.nil?
- assert_nil(matched, message)
- else
- case matched
- when Element
- assert_equal(expected, matched.text, message)
- when Attribute, Text, Comment, TrueClass, FalseClass
- assert_equal(expected, matched.to_s, message)
- when Instruction
- assert_equal(expected, matched.content, message)
- when Integer, Float
- assert_equal(expected.to_f, matched, message)
- when String
- assert_equal(expected, matched, message)
- else
- flunk("#{message}\n" +
- "Unexpected match value: <#{matched.inspect}>")
- end
- end
+ assert_equal(expected || "",
+ REXML::Functions.string(matched),
+ message)
end
# processes a tests/document/context/test node ( where @exception is false or doesn't exist )