aboutsummaryrefslogtreecommitdiff
path: root/file/file_test.go
blob: 783b92cb73161638d577d04018829faa1f4fa89e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
	}
}