Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-05-25 15:14:03 +03:00
parent 03de1ec38f
commit 01e7d81883
2 changed files with 23 additions and 6 deletions

View File

@ -196,10 +196,6 @@ func (w *wrapper) Stream(ctx context.Context, req client.Request, opts ...client
return stream, err
}
func (w *wrapper) Publish(ctx context.Context, p client.Message, opts ...client.PublishOption) error {
return w.Client.Publish(ctx, p, opts...)
}
// NewServerHandlerWrapper create new server handler wrapper
func NewServerHandlerWrapper(opts ...Option) server.HandlerWrapper {
handler := &wrapper{

View File

@ -5,8 +5,29 @@ import (
"testing"
)
func TestTrieBackwards(t *testing.T) {
_ = &Trie{}
func TestTrieWithDot(t *testing.T) {
var err error
type handler struct {
name string
}
tr := NewTrie()
if err = tr.Insert([]string{http.MethodGet}, "/*", &handler{name: "slash_astar"}); err != nil {
t.Fatal(err)
}
if err = tr.Insert([]string{http.MethodGet}, "*", &handler{name: "astar"}); err != nil {
t.Fatal(err)
}
if err = tr.Insert([]string{http.MethodGet}, "/.well-known/test", &handler{name: "well-known"}); err != nil {
t.Fatal(err)
}
h, _, err := tr.Search(http.MethodGet, "/.well-known/test")
if err != nil {
t.Fatalf("unexpected error handler not found")
}
if h.(*handler).name != "well-known" {
t.Fatalf("error matching route with wildcard")
}
}
func TestTrieWildcardPathPrefix(t *testing.T) {