type writerWithFlush … func (w *writerWithFlush) Flush() { … } func (w *writerWithFlush) Write(p []byte) (n int, err error) { … } type writerWithNoFlush … func (w *writerWithNoFlush) Write(p []byte) (n int, err error) { … } func TestWriteWithFlush(t *testing.T) { … } func TestWriteWithoutFlush(t *testing.T) { … } func TestWriteError(t *testing.T) { … }