Files
atomctl/main_test.go
2025-01-15 14:48:51 +08:00

32 lines
600 B
Go

package main
import (
"regexp"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func Test_router(t *testing.T) {
Convey("Test routerPattern", t, func() {
jsonReg := regexp.MustCompile(`Json\[\[?\]?(\w+)\]`)
items := []string{
"Json[abc]",
"Json[[]abc]",
}
types := []string{
"string",
"int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64",
"float32", "float64",
"bool",
}
for _, item := range items {
match := jsonReg.FindStringSubmatch(item)
if len(match) ==2 && !lo.Contains(types, match[1]) { {
}
}
})
}