mirror of
https://gitea.invidious.io/iv-org/shard-radix.git
synced 2024-08-15 00:43:21 +00:00
Fix incorrect lookup in non-root nodes
Given the following non-root tree: tree = Tree(Symbol).new tree.add "/prefix/", :prefix tree.add "/prefix/foo", :foo Attempt to lookup for `/foo` was incorrectly identifying `:foo` entry as the correct value. This change ensures that child nodes of the current node are not scanned if key and path being looked up do not match. Fixes #27
This commit is contained in:
parent
f8df18baf1
commit
f764b3aed2
3 changed files with 18 additions and 0 deletions
|
@ -353,6 +353,15 @@ module Radix
|
|||
result.found?.should be_true
|
||||
result.payload.should eq(:tags)
|
||||
end
|
||||
|
||||
it "do not find when lookup for non-root key" do
|
||||
tree = Tree(Symbol).new
|
||||
tree.add "/prefix/", :prefix
|
||||
tree.add "/prefix/foo", :foo
|
||||
|
||||
result = tree.find "/foo"
|
||||
result.found?.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
context "unicode nodes with shared parent" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue