MCPcopy
hub / github.com/pocketbase/pocketbase / TestToInterfaceSlice

Function TestToInterfaceSlice

tools/list/list_test.go:191–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

189}
190
191func TestToInterfaceSlice(t *testing.T) {
192 scenarios := []struct {
193 items []string
194 }{
195 {[]string{}},
196 {[]string{""}},
197 {[]string{"1", "test"}},
198 {[]string{"test1", "test1", "test2", "test3"}},
199 }
200
201 for i, s := range scenarios {
202 t.Run(fmt.Sprintf("%d_%#v", i, s.items), func(t *testing.T) {
203 result := list.ToInterfaceSlice(s.items)
204
205 if len(result) != len(s.items) {
206 t.Fatalf("Expected length %d, got %d", len(s.items), len(result))
207 }
208
209 for j, v := range result {
210 if v != s.items[j] {
211 t.Fatalf("Result list item doesn't match with the original list item, got %v VS %v", v, s.items[j])
212 }
213 }
214 })
215 }
216}
217
218func TestNonzeroUniquesString(t *testing.T) {
219 scenarios := []struct {

Callers

nothing calls this directly

Calls 2

ToInterfaceSliceFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…