Repository navigation
Conversation
positoin() and namae() were accepted and evaluated as an empty node-set, so a predicate with a typo matched nothing and a name that was also an element name did not say it was unknown.
Evaluation passed an empty node-set as the fallback for a name that is not in the function library. A typo then looked like a predicate that matched nothing. Unknown names now raise ArgumentError, which Functions#call already did when no fallback was given. Fixes ruby#351
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #351.
An unknown function name was evaluated as an empty node-set.
//foo[positoin()=1]matched nothing, and//*[namae()="bar"]did not say thatnamaeis not a function, even when the document has an element of that name. The parser passedfallback: []intoFunctions#call, which only raises when no fallback is given. The code marked that as not the XPath behavior and left it to reconsider.Functions#callis now called without a fallback, so the name raisesArgumentError: Unknown XPath function: positoin. A known name still works, includinglocal_name()outside strict mode, where_is still rewritten to-. In strict modelocal_name()is not a library function and raises too.Functions.sendstill accepts an unknown name and returns the empty fallback, as it did before.ruby test/run.rb: 863 tests, 2743 assertions.