mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
Add notes for the new lead maintainer of the open-source iris project and align with @get-ion/ion by @hiveminded
Former-commit-id: da4f38eb9034daa49446df3ee529423b98f9b331
This commit is contained in:
29
core/router/path_test.go
Normal file
29
core/router/path_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSplitSubdomainAndPath(t *testing.T) {
|
||||
tests := []struct {
|
||||
original string
|
||||
subdomain string
|
||||
path string
|
||||
}{
|
||||
{"admin./users/42", "admin.", "/users/42"},
|
||||
{"//api/users\\42", "", "/api/users/42"},
|
||||
{"admin./users/\\42", "admin.", "/users/42"},
|
||||
{"*./users/\\42", "*.", "/users/42"},
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
subdomain, path := splitSubdomainAndPath(tt.original)
|
||||
|
||||
if expected, got := tt.subdomain, subdomain; expected != got {
|
||||
t.Fatalf("[%d] - expected subdomain '%s' but got '%s'", i, expected, got)
|
||||
}
|
||||
if expected, got := tt.path, path; expected != got {
|
||||
t.Fatalf("[%d] - expected path '%s' but got '%s'", i, expected, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user