Merge pull request #26 from silasb/catch-all-continues-to-check-for-key-chars-when-path-chars-differ

Catch all will continue checking key chars when path chars differ
This commit is contained in:
Luis Lavena 2019-01-02 18:53:50 +01:00 committed by GitHub
commit 461509d7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -451,6 +451,14 @@ module Radix
result.found?.should be_false
end
it "does not find when path search has been exhausted" do
tree = Tree(Symbol).new
tree.add "/members/*trailing", :members_catch_all
result = tree.find("/members2")
result.found?.should be_false
end
it "does prefer specific path over catch all if both are present" do
tree = Tree(Symbol).new
tree.add "/members", :members

View File

@ -324,6 +324,9 @@ module Radix
return
end
end
# path differs from key, no use searching anymore
return
end
# key still contains characters to walk