MCPcopy Create free account
hub / github.com/featureform/featureform / TestNewStructMap

Function TestNewStructMap

helpers/struct_map/struct_map_test.go:8–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestNewStructMap(t *testing.T) {
9 type emptyStruct struct{}
10
11 type args struct {
12 s interface{}
13 }
14 tests := []struct {
15 name string
16 args args
17 expected *StructMap
18 expectedErr bool
19 }{
20 {"Non Struct", args{make(map[string]string)}, nil, true},
21 {"Empty Struct", args{emptyStruct{}}, &StructMap{
22 size: 0,
23 keys: []string{},
24 val: reflect.ValueOf(emptyStruct{}),
25 }, false},
26 }
27 for _, tt := range tests {
28 t.Run(tt.name, func(t *testing.T) {
29 actual, err := NewStructMap(tt.args.s)
30 if (err != nil) != tt.expectedErr {
31 t.Errorf("NewStructMap() error = %v, expectedErr %v", err, tt.expectedErr)
32 return
33 }
34 if !reflect.DeepEqual(actual, tt.expected) {
35 t.Errorf("NewStructMap() actual = %v, expected %v", actual, tt.expected)
36 }
37 })
38 }
39}
40
41func TestStructMapGet(t *testing.T) {
42 type testCase struct {

Callers

nothing calls this directly

Calls 2

NewStructMapFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected