MCPcopy
hub / github.com/go-gorm/gorm / TestToStringKey

Function TestToStringKey

utils/utils_test.go:47–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestToStringKey(t *testing.T) {
48 cases := []struct {
49 values []interface{}
50 key string
51 }{
52 {[]interface{}{"a"}, "a"},
53 {[]interface{}{1, 2, 3}, "1_2_3"},
54 {[]interface{}{1, nil, 3}, "1_nil_3"},
55 {[]interface{}{[]interface{}{1, 2, 3}}, "[1 2 3]"},
56 {[]interface{}{[]interface{}{"1", "2", "3"}}, "[1 2 3]"},
57 {[]interface{}{[]interface{}{"1", nil, "3"}}, "[1 <nil> 3]"},
58 }
59 for _, c := range cases {
60 if key := ToStringKey(c.values...); key != c.key {
61 t.Errorf("%v: expected %v, got %v", c.values, c.key, key)
62 }
63 }
64}
65
66func TestContains(t *testing.T) {
67 containsTests := []struct {

Callers

nothing calls this directly

Calls 1

ToStringKeyFunction · 0.85

Tested by

no test coverage detected