diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index 16177263..a558ccdf 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -428,7 +428,7 @@ def send(name, *args) else # TODO: Maybe, this is not XPath spec behavior. # This behavior must be reconsidered. - XPath.match(@context[:node], name.to_s) + [] end end end diff --git a/test/functions/test_base.rb b/test/functions/test_base.rb index b63f3d5a..4e1bf483 100644 --- a/test/functions/test_base.rb +++ b/test/functions/test_base.rb @@ -299,8 +299,10 @@ def test_nonexistent_function doc = Document.new("") # TODO: Maybe, this is not XPath spec behavior. # This behavior must be reconsidered. - assert_equal(doc.root.elements[1], - XPath::first(doc.root, "nonexistent()")) + assert_nil(XPath::first(doc.root, "nonexistent()")) + assert_empty(XPath::match(doc.root, "nonexistent()")) + assert_empty(XPath::match(doc, "42()/*")) + assert_empty(Functions.send('42')) end end end