Adding upstream version 0.0~git20250501.71edba4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c6ff472a6d
commit
c8085bda34
87 changed files with 24009 additions and 0 deletions
43
encoding_gob_test.go
Normal file
43
encoding_gob_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package activitypub
|
||||
|
||||
/*
|
||||
func TestMarshalGob(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
it Item
|
||||
want []byte
|
||||
wantErr error
|
||||
}{
|
||||
{
|
||||
name: "empty object",
|
||||
it: &Object{
|
||||
ID: "test",
|
||||
},
|
||||
want: []byte{},
|
||||
wantErr: nil,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
buf := bytes.NewBuffer(make([]byte, 0))
|
||||
err := gob.NewEncoder(buf).Encode(tt.it)
|
||||
|
||||
if !errors.Is(err, tt.wantErr) {
|
||||
t.Errorf("MarshalGob() error = %s, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
|
||||
it := new(Object)
|
||||
got := buf.Bytes()
|
||||
if err := gob.NewDecoder(bytes.NewReader(got)).Decode(it); err != nil {
|
||||
t.Errorf("Gob Decoding failed for previously generated output %v", err)
|
||||
}
|
||||
if tt.wantErr == nil {
|
||||
if !assertDeepEquals(t.Errorf, it, tt.it) {
|
||||
t.Errorf("Gob Decoded value is different got = %#v, want %#v", it, tt.it)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue