package file import ( "bytes" "testing" ) func TestSig(t *testing.T) { b := &block{ Comment: "comment", Bytes: []byte{'t', 'e', 's', 't'}, } buf := new(bytes.Buffer) err := encodeBlock(buf, b) if err != nil { t.Error(err) } b2, err := decodeBlock(buf) if err != nil { t.Error(err) } if b.Comment != b2.Comment || !bytes.Equal(b.Bytes, b2.Bytes) { t.Errorf("got %v, want %v", b2, b) } }