From dcf45d21452789b6f49b659a68f58c16d4011607 Mon Sep 17 00:00:00 2001 From: skkiesel Date: Fri, 16 Jun 2017 15:19:11 -0400 Subject: [PATCH] update test case to test exactly what we want --- plugins/babbler/babbler.go | 3 ++- plugins/babbler/babbler_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/babbler/babbler.go b/plugins/babbler/babbler.go index 4dd816b..5b21dea 100644 --- a/plugins/babbler/babbler.go +++ b/plugins/babbler/babbler.go @@ -121,7 +121,8 @@ func (p *BabblerPlugin) Message(message msg.Message) bool { saidWhat, saidSomething = p.getBabbleWithSuffix(tokens) } else if numTokens >= 2 && tokens[1] == "says-middle-out" { saidWhatStart, saidSomethingStart := p.getBabbleWithSuffix(tokens) - if !saidSomethingStart || saidWhatStart == strings.Join(tokens[2:], " ") { + neverSaidLooksLike := fmt.Sprintf("%s never said '%s'", tokens[0], strings.Join(tokens[2:], " ")) + if !saidSomethingStart || saidWhatStart == neverSaidLooksLike { saidSomething = saidSomethingStart saidWhat = saidWhatStart } else { diff --git a/plugins/babbler/babbler_test.go b/plugins/babbler/babbler_test.go index d3e0727..b574f6a 100644 --- a/plugins/babbler/babbler_test.go +++ b/plugins/babbler/babbler_test.go @@ -262,7 +262,7 @@ func TestBabblerBadMiddleOutSeed(t *testing.T) { res = c.Message(makeMessage("!seabass says-middle-out anything true")) assert.Len(t, mb.Messages, 1) assert.True(t, res) - assert.Contains(t, mb.Messages[0], "seabass never said 'anything true'") + assert.Equal(t, mb.Messages[0], "seabass never said 'anything true'") }