MCPcopy Create free account
hub / github.com/Shopify/goose / TestReadFromNegativeReader

Function TestReadFromNegativeReader

syncio/buffer_test.go:279–297  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

277}
278
279func TestReadFromNegativeReader(t *testing.T) {
280 var b Buffer
281 defer func() {
282 switch err := recover().(type) {
283 case nil:
284 t.Fatal("bytes.Buffer.ReadFrom didn't panic")
285 case error:
286 // this is the error string of errNegativeRead
287 wantError := "bytes.Buffer: reader returned negative count from Read"
288 if err.Error() != wantError {
289 t.Fatalf("recovered panic: got %v, want %v", err.Error(), wantError)
290 }
291 default:
292 t.Fatalf("unexpected panic value: %#v", err)
293 }
294 }()
295
296 b.ReadFrom(new(negativeReader))
297}
298
299func TestWriteTo(t *testing.T) {
300 var buf Buffer

Callers

nothing calls this directly

Calls 2

ReadFromMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected