beat_test.go
1 package plugins 2 3 import ( 4 "testing" 5 ) 6 7 func TestBeatMatch(t *testing.T) { 8 testStrings := make(map[string]bool) 9 testStrings["what time is it??!!?!"] = true 10 testStrings["what time is it"] = false 11 testStrings["man: 2 pledge"] = false 12 testStrings[".beat"] = true 13 testStrings["beattime?"] = true 14 testStrings["beat time?"] = true 15 16 b := &Beat{} 17 for msg, should := range testStrings { 18 if b.Match("", msg) != should { 19 t.Errorf("Beat expected to match %q (%t); but doesn't\n", msg, should) 20 } 21 } 22 }