MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / xEncoding

Function xEncoding

pkg/encoding/encoding_test.go:15–33  ·  view source on GitHub ↗
(e Encoding)

Source from the content-addressed store, hash-verified

13}
14
15func xEncoding(e Encoding) error {
16 o1 := &obj{ID: 1, Name: "foo"}
17 data, err := Marshal(e, o1)
18 if err != nil {
19 return err
20 }
21
22 o2 := &obj{}
23 err = Unmarshal(e, data, o2)
24 if err != nil {
25 return err
26 }
27
28 if o1.ID != o2.ID {
29 return errors.New("Unmarshal failed")
30 }
31
32 return nil
33}
34
35func TestEncoding(t *testing.T) {
36 err := xEncoding(GobEncoding{})

Callers 1

TestEncodingFunction · 0.85

Calls 2

MarshalFunction · 0.85
UnmarshalFunction · 0.85

Tested by

no test coverage detected