We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 46f97db commit f6ff417Copy full SHA for f6ff417
cobs_test.go
@@ -291,6 +291,31 @@ func FuzzChainWriter(f *testing.F) {
291
})
292
}
293
294
+var incompleteFrame = []struct {
295
+ name string
296
+ data []byte
297
+}{
298
+ {
299
+ name: "Missing single byte",
300
+ data: []byte{0x02},
301
+ },
302
303
+ name: "2 zeroes and missing end",
304
+ data: []byte{0x01, 0x01, 0x05},
305
306
+}
307
+
308
+func TestDecodeIncomplete(t *testing.T) {
309
+ for _, tc := range incompleteFrame {
310
+ t.Run(tc.name, func(t *testing.T) {
311
+ _, err := Decode(tc.data)
312
+ if err != ErrIncompleteFrame {
313
+ t.Errorf("Unexpected decode incomplete error: %v", err)
314
+ }
315
+ })
316
317
318
319
// https://github.com/golang/go/issues/54111
320
type LimitedWriter struct {
321
W io.Writer // underlying writer
0 commit comments