diff options
| author | 2026-03-06 16:46:51 +0800 | |
|---|---|---|
| committer | 2026-03-06 16:46:51 +0800 | |
| commit | 9e44418ce9d88f4159067b1ce2c808cb93e29c38 (patch) | |
| tree | 4ff99e20df4ec1c6ddb8508202fcb28aa42551eb /format/sideband64k/encoder_partial_write_test.go | |
| parent | format/sideband64k: Add side-band-64k (diff) | |
| signature | No signature | |
format/sideband64k: Lint
Diffstat (limited to 'format/sideband64k/encoder_partial_write_test.go')
| -rw-r--r-- | format/sideband64k/encoder_partial_write_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/format/sideband64k/encoder_partial_write_test.go b/format/sideband64k/encoder_partial_write_test.go index c82b1902..3d4f8066 100644 --- a/format/sideband64k/encoder_partial_write_test.go +++ b/format/sideband64k/encoder_partial_write_test.go @@ -1,6 +1,7 @@ package sideband64k_test import ( + "errors" "io" "testing" @@ -13,16 +14,20 @@ func TestEncoderHandlesPartialWrites(t *testing.T) { dst := &limitWriter{maxPerWrite: 2} enc := sideband64k.NewEncoder(dst) - if err := enc.WriteProgress([]byte("abc")); err != nil { + err := enc.WriteProgress([]byte("abc")) + if err != nil { t.Fatalf("WriteProgress: %v", err) } - if err := enc.WriteFlushAndFlushIO(); err != nil { + + err = enc.WriteFlushAndFlushIO() + if err != nil { t.Fatalf("WriteFlushAndFlushIO: %v", err) } if got, want := dst.buf.String(), "0008\x02abc0000"; got != want { t.Fatalf("got %q, want %q", got, want) } + if dst.flushes != 1 { t.Fatalf("flushes=%d, want 1", dst.flushes) } @@ -35,7 +40,7 @@ func TestEncoderReturnsShortWrite(t *testing.T) { enc := sideband64k.NewEncoder(dst) err := enc.WriteData([]byte("x")) - if err != io.ErrShortWrite { + if !errors.Is(err, io.ErrShortWrite) { t.Fatalf("got err %v, want io.ErrShortWrite", err) } } |
