diff --git a/client/connection_test.go b/client/connection_test.go index cc1829b..e6d593f 100644 --- a/client/connection_test.go +++ b/client/connection_test.go @@ -42,14 +42,14 @@ func setUp(t *testing.T, start ...bool) (*Conn, *testState) { // Hack to allow tests of send, recv, write etc. // NOTE: the value of the boolean doesn't matter. c.postConnect() + // Sleep 1ms to allow background routines to start. + <-time.After(1e6) } return c, &testState{ctrl, l, st, ed, nc, c} } func (s *testState) tearDown() { - // This can get set to false in some tests - s.c.st = true s.ed.EXPECT().Dispatch("disconnected", s.c, &Line{}) s.st.EXPECT().Wipe() s.log.EXPECT().Error("irc.recv(): %s", "EOF") @@ -362,7 +362,6 @@ func TestWrite(t *testing.T) { // again, to prevent deadlocks when these are both called synchronously. // XXX: This may well be a horrible hack. go func() { - s.nc.Read(make([]byte, 0)) <-c.cSend <-c.cLoop }() diff --git a/client/handlers_test.go b/client/handlers_test.go index bc2c272..e4b3e78 100644 --- a/client/handlers_test.go +++ b/client/handlers_test.go @@ -74,6 +74,7 @@ func Test433(t *testing.T) { if c.Me.Nick != "test_" { t.Errorf("My nick not updated from '%s'.", c.Me.Nick) } + c.st = true } // Test the handler for NICK messages when state tracking is disabled