MCPcopy Create free account
hub / github.com/dolanor/rip / TestDecoder_Decode

Function TestDecoder_Decode

encoding/protobuf/decoder_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestDecoder_Decode(t *testing.T) {
11 f, err := os.Open("testdata/user.pb")
12 if err != nil {
13 t.Fatal(err)
14 }
15
16 d := newDecoder(f)
17
18 var user testdata.User
19 err = d.Decode(&user)
20 if err != nil {
21 t.Fatal(err)
22 }
23
24 if user.Name != "Tanguy" {
25 t.Fatal("could not decode name")
26 }
27
28 if user.Id != 1 {
29 t.Fatal("could not decode ID")
30 }
31}

Callers

nothing calls this directly

Calls 2

newDecoderFunction · 0.85
DecodeMethod · 0.65

Tested by

no test coverage detected