mirror of
https://github.com/golang/go
synced 2024-11-17 13:14:56 -07:00
io: add ErrBadWriteCount
Change-Id: I04aebbaeb504f3b856b351bb924b1bce9a015083
This commit is contained in:
parent
838d6bac72
commit
19cbb1461c
@ -431,7 +431,7 @@ func TestSectionReader_Size(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// largeWriter returns an invalid count that is larger than the number
|
// largeWriter returns an invalid count that is larger than the number
|
||||||
// of bytes requested (issue 39978).
|
// of bytes provided (issue 39978).
|
||||||
type largeWriter struct {
|
type largeWriter struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
@ -446,16 +446,14 @@ func TestCopyLargeWriter(t *testing.T) {
|
|||||||
wb := largeWriter{}
|
wb := largeWriter{}
|
||||||
rb.WriteString("hello, world.")
|
rb.WriteString("hello, world.")
|
||||||
if _, err := Copy(wb, rb); err != want {
|
if _, err := Copy(wb, rb); err != want {
|
||||||
t.Errorf("Copy Error: got %v, want %v", err, want)
|
t.Errorf("Copy error: got %v, want %v", err, want)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func TestCopyLargeWriterError(t *testing.T) {
|
want = errors.New("largeWriterError")
|
||||||
want := errors.New("largerWriteError")
|
rb = new(Buffer)
|
||||||
rb := new(Buffer)
|
wb = largeWriter{err: want}
|
||||||
wb := largeWriter{err: want}
|
|
||||||
rb.WriteString("hello, world.")
|
rb.WriteString("hello, world.")
|
||||||
if _, err := Copy(wb, rb); err != want {
|
if _, err := Copy(wb, rb); err != want {
|
||||||
t.Errorf("Copy Error: got %v, want %v", err, want)
|
t.Errorf("Copy error: got %v, want %v", err, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user