MCPcopy
hub / github.com/zeromicro/go-zero / Test_parseTableList

Function Test_parseTableList

tools/goctl/model/sql/command/command_test.go:115–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func Test_parseTableList(t *testing.T) {
116 testData := []string{"foo", "b*", "bar", "back_up", "foo,bar,b*"}
117 patterns := parseTableList(testData)
118 actual := patterns.list()
119 expected := []string{"foo", "b*", "bar", "back_up"}
120 sort.Slice(actual, func(i, j int) bool {
121 return actual[i] > actual[j]
122 })
123 sort.Slice(expected, func(i, j int) bool {
124 return expected[i] > expected[j]
125 })
126 assert.Equal(t, strings.Join(expected, ","), strings.Join(actual, ","))
127
128 matchTestData := map[string]bool{
129 "foo": true,
130 "bar": true,
131 "back_up": true,
132 "bit": true,
133 "ab": false,
134 "b": true,
135 }
136 for v, expected := range matchTestData {
137 actual := patterns.Match(v)
138 assert.Equal(t, expected, actual)
139 }
140}

Callers

nothing calls this directly

Calls 5

parseTableListFunction · 0.85
listMethod · 0.80
JoinMethod · 0.80
MatchMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…