mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Vendor dependencies
This commit is contained in:
committed by
Zlatko Čalušić
parent
2f0a16d8b7
commit
6054876201
38
vendor/goji.io/pattern/pattern_test.go
generated
vendored
Normal file
38
vendor/goji.io/pattern/pattern_test.go
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package pattern
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type boolPattern bool
|
||||
|
||||
func (b boolPattern) Match(ctx context.Context, r *http.Request) context.Context {
|
||||
if b {
|
||||
return ctx
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type prefixPattern string
|
||||
|
||||
func (p prefixPattern) Match(ctx context.Context, r *http.Request) context.Context {
|
||||
return ctx
|
||||
}
|
||||
func (p prefixPattern) PathPrefix() string {
|
||||
return string(p)
|
||||
}
|
||||
|
||||
func TestPathRoundTrip(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := SetPath(context.Background(), "hi")
|
||||
if path := Path(ctx); path != "hi" {
|
||||
t.Errorf("expected hi, got %q", path)
|
||||
}
|
||||
|
||||
if path := Path(context.Background()); path != "" {
|
||||
t.Errorf("expected empty path, got %q", path)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user