Skip to content

Commit c1040a5

Browse files
author
Guy Baron
committed
added more error testing for proto serializer
1 parent 9e5407b commit c1040a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/protoSerialization_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tests
22

33
import (
4+
"crypto/rand"
45
"reflect"
56
"testing"
67

@@ -85,4 +86,11 @@ func TestProtoSerializationErrors(t *testing.T) {
8586
t.Errorf("decoding an unregistred schema is expected to return an error but did not")
8687
}
8788

89+
//decoding junk fails and returns an error
90+
junk := make([]byte, 16)
91+
rand.Read(junk)
92+
if _, decErr := serializer.Decode(junk, cmd.SchemaName()); decErr == nil {
93+
t.Errorf("decoding junk is expected to return an error but did not")
94+
}
95+
8896
}

0 commit comments

Comments
 (0)