MCPcopy Create free account
hub / github.com/creasty/defaults / TestSet_PointerToStruct

Function TestSet_PointerToStruct

set_pointer_test.go:41–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestSet_PointerToStruct(t *testing.T) {
42 type inner struct {
43 Name string `default:"inner"`
44 Foo int
45 }
46 type sample struct {
47 Ptr *inner `default:"{}"`
48 }
49
50 var got sample
51 require.NoError(t, defaults.Set(&got))
52
53 require.NotNil(t, got.Ptr)
54 assert.Equal(t, inner{Name: "inner"}, *got.Ptr)
55}
56
57func TestSet_PointerToStructWithJSONTag(t *testing.T) {
58 type inner struct {

Callers

nothing calls this directly

Calls 1

SetFunction · 0.92

Tested by

no test coverage detected