aboutsummaryrefslogtreecommitdiff
path: root/file/file_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-07-23 01:55:55 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-07-23 01:55:55 +0200
commit39d333ae8300eb3bc19384626d1b3f08b3eb7333 (patch)
tree809a094f2a6892f03ebfa15af380344ceab04cb4 /file/file_test.go
parent088135569acd6617c929b64e644e377e316f7df1 (diff)
...
Diffstat (limited to 'file/file_test.go')
-rw-r--r--file/file_test.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/file/file_test.go b/file/file_test.go
index b35c147..3bf8f1f 100644
--- a/file/file_test.go
+++ b/file/file_test.go
@@ -5,21 +5,27 @@ import (
"testing"
)
+type moc struct{}
+
+func (moc) MarshalBinary() ([]byte, error) { return nil, nil }
+func (moc) UnmarshalBinary(_ []byte) error { return nil }
+
func TestSig(t *testing.T) {
- b := &block{
- Comment: "comment",
- Bytes: []byte{'t', 'e', 's', 't'},
- }
+ comment := "comment"
+ message := []byte{'t', 'e', 's', 't'}
buf := new(bytes.Buffer)
- err := encodeBlock(buf, b)
+ err := Encode(buf, moc{}, comment, message)
if err != nil {
t.Error(err)
}
- b2, err := decodeBlock(buf)
+ comment2, message2, err := Decode(buf, moc{})
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)
+ if comment != comment2 {
+ t.Errorf("got %v, want %v", comment2, comment)
+ }
+ if !bytes.Equal(message, message2) {
+ t.Errorf("got %v, want %v", message2, message)
}
}