MCPcopy Create free account
hub / github.com/google/go-cloud / TestNativeCodec

Function TestNativeCodec

docstore/gcpfirestore/native_codec_test.go:131–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func TestNativeCodec(t *testing.T) {
132 nc, err := newNativeCodec()
133 if err != nil {
134 t.Fatal(err)
135 }
136 type S struct {
137 A int
138 }
139 want := S{3}
140 fields, err := nc.Encode(&want)
141 if err != nil {
142 t.Fatal(err)
143 }
144 var got S
145 if err := nc.Decode(fields, &got); err != nil {
146 t.Fatal(err)
147 }
148 if !cmp.Equal(got, want) {
149 t.Errorf("got %+v, want %+v", got, want)
150 }
151}

Callers

nothing calls this directly

Calls 3

newNativeCodecFunction · 0.85
EncodeMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected