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 f6ff417 commit 078b489Copy full SHA for 078b489
cobs_test.go
@@ -316,6 +316,31 @@ func TestDecodeIncomplete(t *testing.T) {
316
}
317
318
319
+var unexpectedDelimiter = []struct {
320
+ name string
321
+ data []byte
322
+}{
323
+ {
324
+ name: "Missing byte before delimiter",
325
+ data: []byte{0x02, 0x00},
326
+ },
327
328
+ name: "Unexpected embedded zero",
329
+ data: []byte("\x061234\x005\x056789"),
330
331
+}
332
+
333
+func TestDecodeUnexpectedEOD(t *testing.T) {
334
+ for _, tc := range unexpectedDelimiter {
335
+ t.Run(tc.name, func(t *testing.T) {
336
+ _, err := Decode(tc.data)
337
+ if err != ErrUnexpectedEOD {
338
+ t.Errorf("Unexpected decode EOD error: %v", err)
339
+ }
340
+ })
341
342
343
344
// https://github.com/golang/go/issues/54111
345
type LimitedWriter struct {
346
W io.Writer // underlying writer
0 commit comments