I have a table-driven test case like this one:
func CountWords(s string) map[string]int func TestCountWords(t *testing.T) { var tests = []struct { input s
This is what I would do (untested code):
func eq(a, b map[string]int) bool { if len(a) != len(b) { return false } for k, v := range a { if w, ok := b[k]; !ok || v != w { return false } } return true }