Call init in connect so theres no special casing for tests.

This commit is contained in:
Chris Rhodes 2013-02-15 19:47:10 -08:00
parent 8e16f59b5f
commit ed85f957b5
2 changed files with 1 additions and 4 deletions

View File

@ -171,6 +171,7 @@ func (conn *Conn) Connect(host string, pass ...string) error {
conn.password = "" conn.password = ""
} }
conn.postConnect() conn.postConnect()
conn.dispatch(&Line{Cmd: INIT})
return nil return nil
} }
@ -188,7 +189,6 @@ func (conn *Conn) postConnect() {
go func() { <-conn.cPing }() go func() { <-conn.cPing }()
} }
go conn.runLoop() go conn.runLoop()
conn.dispatch(&Line{Cmd: INIT})
} }
// copied from http.client for great justice // copied from http.client for great justice

View File

@ -33,9 +33,6 @@ 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()
// All connections start with NICK/USER expect these.
nc.Expect("NICK test")
nc.Expect("USER test 12 * :Testing IRC")
// Sleep 1ms to allow background routines to start. // Sleep 1ms to allow background routines to start.
<-time.After(1e6) <-time.After(1e6)