aboutsummaryrefslogtreecommitdiff
path: root/format/sideband64k/encoder_partial_write_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-10 13:28:59 +0800
committerGravatar Runxi Yu2026-03-10 13:28:59 +0800
commitaf08c84539f9353718604988ba27ae3c466860fc (patch)
tree0f1f2536f57af69b55ae06e78efbe26a7a0b3633 /format/sideband64k/encoder_partial_write_test.go
parentforgejo, github: Update issue templates (diff)
signatureNo signature
*: Move sideband64k and pktline to protocol/
Diffstat (limited to 'format/sideband64k/encoder_partial_write_test.go')
-rw-r--r--format/sideband64k/encoder_partial_write_test.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/format/sideband64k/encoder_partial_write_test.go b/format/sideband64k/encoder_partial_write_test.go
deleted file mode 100644
index 3d4f8066..00000000
--- a/format/sideband64k/encoder_partial_write_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package sideband64k_test
-
-import (
- "errors"
- "io"
- "testing"
-
- "codeberg.org/lindenii/furgit/format/sideband64k"
-)
-
-func TestEncoderHandlesPartialWrites(t *testing.T) {
- t.Parallel()
-
- dst := &limitWriter{maxPerWrite: 2}
- enc := sideband64k.NewEncoder(dst)
-
- err := enc.WriteProgress([]byte("abc"))
- if err != nil {
- t.Fatalf("WriteProgress: %v", err)
- }
-
- 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)
- }
-}
-
-func TestEncoderReturnsShortWrite(t *testing.T) {
- t.Parallel()
-
- dst := &limitWriter{shortWrite: true}
- enc := sideband64k.NewEncoder(dst)
-
- err := enc.WriteData([]byte("x"))
- if !errors.Is(err, io.ErrShortWrite) {
- t.Fatalf("got err %v, want io.ErrShortWrite", err)
- }
-}