Debian Codegraph @

encoding_gob_test.go

raw symbols SCIP
1 package activitypub
2
3 /*
4 func TestMarshalGob(t *testing.T) {
5 tests := []struct {
6 name string
7 it Item
8 want []byte
9 wantErr error
10 }{
11 {
12 name: "empty object",
13 it: &Object{
14 ID: "test",
15 },
16 want: []byte{},
17 wantErr: nil,
18 },
19 }
20 for _, tt := range tests {
21 t.Run(tt.name, func(t *testing.T) {
22 buf := bytes.NewBuffer(make([]byte, 0))
23 err := gob.NewEncoder(buf).Encode(tt.it)
24
25 if !errors.Is(err, tt.wantErr) {
26 t.Errorf("MarshalGob() error = %s, wantErr %v", err, tt.wantErr)
27 return
28 }
29
30 it := new(Object)
31 got := buf.Bytes()
32 if err := gob.NewDecoder(bytes.NewReader(got)).Decode(it); err != nil {
33 t.Errorf("Gob Decoding failed for previously generated output %v", err)
34 }
35 if tt.wantErr == nil {
36 if !assertDeepEquals(t.Errorf, it, tt.it) {
37 t.Errorf("Gob Decoded value is different got = %#v, want %#v", it, tt.it)
38 }
39 }
40 })
41 }
42 }
43 */