Improved test coverage
This commit is contained in:
12
Tree.go
12
Tree.go
@ -130,6 +130,8 @@ begin:
|
||||
return node.data
|
||||
}
|
||||
|
||||
// node: /|*any
|
||||
// path: /|image.png
|
||||
if lastWildcard != nil {
|
||||
addParameter(lastWildcard.prefix, path[lastWildcardOffset:])
|
||||
return lastWildcard.data
|
||||
@ -193,9 +195,9 @@ begin:
|
||||
|
||||
// node: /|*any
|
||||
// path: /|image.png
|
||||
if node.wildcard != nil {
|
||||
addParameter(node.wildcard.prefix, path[i:])
|
||||
return node.wildcard.data
|
||||
if lastWildcard != nil {
|
||||
addParameter(lastWildcard.prefix, path[lastWildcardOffset:])
|
||||
return lastWildcard.data
|
||||
}
|
||||
|
||||
return empty
|
||||
@ -217,8 +219,8 @@ begin:
|
||||
}
|
||||
}
|
||||
|
||||
// Bind binds all handlers to a new one provided by the callback.
|
||||
func (tree *Tree[T]) Bind(transform func(T) T) {
|
||||
// Map binds all handlers to a new one provided by the callback.
|
||||
func (tree *Tree[T]) Map(transform func(T) T) {
|
||||
tree.root.each(func(node *treeNode[T]) {
|
||||
node.data = transform(node.data)
|
||||
})
|
||||
|
Reference in New Issue
Block a user