From b8c3f4225252c5f5697d7943322a332517651cd2 Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Wed, 24 Aug 2011 12:45:32 +0100 Subject: [PATCH] Better line ending handling in MockNetConn. --- client/mocknetconn_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/mocknetconn_test.go b/client/mocknetconn_test.go index 6465fba..0b52860 100644 --- a/client/mocknetconn_test.go +++ b/client/mocknetconn_test.go @@ -3,6 +3,7 @@ package client import ( "net" "os" + "strings" "testing" "time" ) @@ -81,7 +82,8 @@ func (m *mockNetConn) Expect(e string) { "Expected: '%s', got nothing.", e) case s := <-m.Out: t.Stop() - if e + "\r\n" != s { + s = strings.Trim(s, "\r\n") + if e != s { m.Errorf("Mock connection received unexpected value.\n\t" + "Expected: '%s'\n\tGot: '%s'", e, s) } @@ -94,6 +96,7 @@ func (m *mockNetConn) ExpectNothing() { case <-t.C: case s := <-m.Out: t.Stop() + s = strings.Trim(s, "\r\n") m.Errorf("Mock connection received unexpected output.\n\t" + "Expected nothing, got: '%s'", s) }