Misc minor fixen.

This commit is contained in:
Alex Bramley 2011-11-11 10:49:33 +00:00
parent 6a54622df9
commit dbc9c5f09d
2 changed files with 3 additions and 3 deletions

View File

@ -42,14 +42,14 @@ func setUp(t *testing.T, start ...bool) (*Conn, *testState) {
// Hack to allow tests of send, recv, write etc. // Hack to allow tests of send, recv, write etc.
// NOTE: the value of the boolean doesn't matter. // NOTE: the value of the boolean doesn't matter.
c.postConnect() c.postConnect()
// Sleep 1ms to allow background routines to start.
<-time.After(1e6)
} }
return c, &testState{ctrl, l, st, ed, nc, c} return c, &testState{ctrl, l, st, ed, nc, c}
} }
func (s *testState) tearDown() { 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.ed.EXPECT().Dispatch("disconnected", s.c, &Line{})
s.st.EXPECT().Wipe() s.st.EXPECT().Wipe()
s.log.EXPECT().Error("irc.recv(): %s", "EOF") 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. // again, to prevent deadlocks when these are both called synchronously.
// XXX: This may well be a horrible hack. // XXX: This may well be a horrible hack.
go func() { go func() {
s.nc.Read(make([]byte, 0))
<-c.cSend <-c.cSend
<-c.cLoop <-c.cLoop
}() }()

View File

@ -74,6 +74,7 @@ func Test433(t *testing.T) {
if c.Me.Nick != "test_" { if c.Me.Nick != "test_" {
t.Errorf("My nick not updated from '%s'.", c.Me.Nick) 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 // Test the handler for NICK messages when state tracking is disabled