Skip to content

Commit

Permalink
Test HandleIO loop with error reader
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Nov 19, 2013
1 parent d661b11 commit 87b02f6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ func TestTransmitRes(t *testing.T) {
}
}

type closedrwc struct{}

func (c closedrwc) Close() error {
return nil
}

func (c closedrwc) Write([]byte) (int, error) {
return 0, io.EOF
}

func (c closedrwc) Read([]byte) (int, error) {
return 0, io.EOF
}

func TestHandleIO(t *testing.T) {
c := closedrwc{}
err := HandleIO(c, nil)
if err != io.EOF {
t.Errorf("Expected EOF, got %v", err)
}
}

func BenchmarkTransmitRes(b *testing.B) {
bout := &bytes.Buffer{}

Expand Down

0 comments on commit 87b02f6

Please sign in to comment.