From 59b18b038bada0ae5779451723a8dc5d58fa3fa2 Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Tue, 23 Aug 2011 10:44:14 +0100 Subject: [PATCH] MockNetConn: Add ExpectNothing() helper. --- client/mocknetconn_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/mocknetconn_test.go b/client/mocknetconn_test.go index 5a34140..6465fba 100644 --- a/client/mocknetconn_test.go +++ b/client/mocknetconn_test.go @@ -88,6 +88,17 @@ func (m *mockNetConn) Expect(e string) { } } +func (m *mockNetConn) ExpectNothing() { + t := time.NewTimer(5e6) + select { + case <-t.C: + case s := <-m.Out: + t.Stop() + m.Errorf("Mock connection received unexpected output.\n\t" + + "Expected nothing, got: '%s'", s) + } +} + // Implement net.Conn interface func (m *mockNetConn) Read(b []byte) (int, os.Error) { if m.closed {