1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 11:27:06 +00:00

add a new 'uuid' path parameter type e.g. /{id:uuid}

This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-02-12 17:12:23 +02:00
parent 590e999688
commit 5fe233278a
4 changed files with 58 additions and 0 deletions

View File

@@ -419,6 +419,24 @@ func TestPathEvaluatorRaw(t *testing.T) {
}
}
func TestUUIDEvaluatorRaw(t *testing.T) {
tests := []struct {
pass bool
input string
}{
{true, "978ad967-5fad-4c82-af99-580097ace662"}, // v4
{true, "c7067f9c-6d43-11eb-9439-0242ac130002"}, // v1
{false, "astring"}, // 0
{false, "astringwith_numb3rS_and_symbol$"}, // 1
{false, "32321"}, // 2
{false, "main.css"}, // 3
{false, "/assets/main.css"}, // 4
}
for i, tt := range tests {
testEvaluatorRaw(t, UUID, tt.input, reflect.String, tt.pass, i)
}
}
func TestConvertBuilderFunc(t *testing.T) {
fn := func(min uint64, slice []string) func(string) bool {
return func(paramValue string) bool {