aboutsummaryrefslogtreecommitdiff
path: root/protocol/sideband64k/encoder_partial_write_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-25 16:22:03 +0000
committerGravatar Runxi Yu2026-03-25 16:22:03 +0000
commit311edcd50f3a84f4b860bde3cb887451d74eaa11 (patch)
treebe7aa5e9a51e636358f33b1c90637b5024b70dc3 /protocol/sideband64k/encoder_partial_write_test.go
parentREADME: Split off contrib, benchmarks, remove history for now I guess, etc. (diff)
signatureNo signature
network/protocol: Rename from protocol v0.1.110
Diffstat (limited to 'protocol/sideband64k/encoder_partial_write_test.go')
-rw-r--r--protocol/sideband64k/encoder_partial_write_test.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/protocol/sideband64k/encoder_partial_write_test.go b/protocol/sideband64k/encoder_partial_write_test.go
deleted file mode 100644
index 3cec9324..00000000
--- a/protocol/sideband64k/encoder_partial_write_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package sideband64k_test
-
-import (
- "errors"
- "io"
- "testing"
-
- "codeberg.org/lindenii/furgit/protocol/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)
- }
-}