diff options
| author | 2026-03-10 13:28:59 +0800 | |
|---|---|---|
| committer | 2026-03-10 13:28:59 +0800 | |
| commit | af08c84539f9353718604988ba27ae3c466860fc (patch) | |
| tree | 0f1f2536f57af69b55ae06e78efbe26a7a0b3633 /format/sideband64k/encoder_partial_write_test.go | |
| parent | forgejo, github: Update issue templates (diff) | |
| signature | No 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.go | 46 |
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) - } -} |
