SimpleClient shouldn't need to return an error.

This commit is contained in:
Alex Bramley 2013-02-18 01:42:44 +00:00
parent 8ed96e4294
commit fd6fc1269b
2 changed files with 5 additions and 4 deletions

View File

@ -87,8 +87,9 @@ func NewConfig(nick string, args ...string) *Config {
// Creates a new IRC connection object, but doesn't connect to anything so // Creates a new IRC connection object, but doesn't connect to anything so
// that you can add event handlers to it. See AddHandler() for details // that you can add event handlers to it. See AddHandler() for details
func SimpleClient(nick string, args ...string) (*Conn, error) { func SimpleClient(nick string, args ...string) *Conn {
return Client(NewConfig(nick, args...)) conn, _ := Client(NewConfig(nick, args...))
return conn
} }
func Client(cfg *Config) (*Conn, error) { func Client(cfg *Config) (*Conn, error) {

View File

@ -21,7 +21,7 @@ func setUp(t *testing.T, start ...bool) (*Conn, *testState) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
st := state.NewMockTracker(ctrl) st := state.NewMockTracker(ctrl)
nc := MockNetConn(t) nc := MockNetConn(t)
c, _ := SimpleClient("test", "test", "Testing IRC") c := SimpleClient("test", "test", "Testing IRC")
logging.SetLogLevel(logging.LogFatal) logging.SetLogLevel(logging.LogFatal)
c.st = st c.st = st
@ -82,7 +82,7 @@ func TestEOF(t *testing.T) {
func TestClientAndStateTracking(t *testing.T) { func TestClientAndStateTracking(t *testing.T) {
ctrl := gomock.NewController(t) ctrl := gomock.NewController(t)
st := state.NewMockTracker(ctrl) st := state.NewMockTracker(ctrl)
c, _ := SimpleClient("test", "test", "Testing IRC") c := SimpleClient("test", "test", "Testing IRC")
// Assert some basic things about the initial state of the Conn struct // Assert some basic things about the initial state of the Conn struct
if me := c.cfg.Me; me.Nick != "test" || me.Ident != "test" || if me := c.cfg.Me; me.Nick != "test" || me.Ident != "test" ||