From a78aed7e7cc1c5a75d43ecad8ec940696b6cf514 Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Sat, 4 Feb 2012 23:32:39 +0000 Subject: [PATCH] Functions are not comparable any more, so only compare event names. --- client/connection_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client/connection_test.go b/client/connection_test.go index 923d6aa..6e9e4e5 100644 --- a/client/connection_test.go +++ b/client/connection_test.go @@ -91,8 +91,12 @@ func TestClientAndStateTracking(t *testing.T) { l := logging.NewMockLogger(ctrl) st := state.NewMockStateTracker(ctrl) - for n, h := range intHandlers { - r.EXPECT().AddHandler(h, n) + for n, _ := range intHandlers { + // We can't use EXPECT() here as comparisons of functions are + // no longer valid in Go, which causes reflect.DeepEqual to bail. + // Instead, ignore the function arg and just ensure that all the + // handler names are correctly passed to AddHandler. + ctrl.RecordCall(r, "AddHandler", gomock.Any(), []string{n}) } c := Client("test", "test", "Testing IRC", r, l) @@ -109,8 +113,9 @@ func TestClientAndStateTracking(t *testing.T) { } // OK, while we're here with a mock event registry... - for n, h := range stHandlers { - r.EXPECT().AddHandler(h, n) + for n, _ := range stHandlers { + // See above. + ctrl.RecordCall(r, "AddHandler", gomock.Any(), []string{n}) } c.EnableStateTracking() @@ -127,8 +132,9 @@ func TestClientAndStateTracking(t *testing.T) { me := c.Me c.ST = st st.EXPECT().Wipe() - for n, h := range stHandlers { - r.EXPECT().DelHandler(h, n) + for n, _ := range stHandlers { + // See above. + ctrl.RecordCall(r, "DelHandler", gomock.Any(), []string{n}) } c.DisableStateTracking() if c.st || c.ST != nil || c.Me != me {