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

Function TestEncoder_Encode

encoding/protobuf/encoder_test.go:11–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestEncoder_Encode(t *testing.T) {
12 w := testdata.User{
13 Name: "Tanguy",
14 Id: 1,
15 }
16
17 var b bytes.Buffer
18 e := newEncoder(&b)
19
20 err := e.Encode(&w)
21 if err != nil {
22 t.Fatal(err)
23 }
24
25 exp, err := os.ReadFile("testdata/user.pb")
26 if err != nil {
27 t.Fatal(err)
28 }
29
30 if string(b.Bytes()) != string(exp) {
31 t.Fatal(err)
32 }
33}

Callers

nothing calls this directly

Calls 2

newEncoderFunction · 0.85
EncodeMethod · 0.65

Tested by

no test coverage detected