Compare commits

...

1 Commits
master ... tmp

Author SHA1 Message Date
01e7d81883 tmp
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-25 15:14:03 +03:00
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 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 // NewServerHandlerWrapper create new server handler wrapper
func NewServerHandlerWrapper(opts ...Option) server.HandlerWrapper { func NewServerHandlerWrapper(opts ...Option) server.HandlerWrapper {
handler := &wrapper{ handler := &wrapper{

View File

@ -5,8 +5,29 @@ import (
"testing" "testing"
) )
func TestTrieBackwards(t *testing.T) { func TestTrieWithDot(t *testing.T) {
_ = &Trie{} 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) { func TestTrieWildcardPathPrefix(t *testing.T) {