update test case to test exactly what we want

This commit is contained in:
skkiesel 2017-06-16 15:19:11 -04:00
parent 8735a2283b
commit dcf45d2145
2 changed files with 3 additions and 2 deletions

View File

@ -121,7 +121,8 @@ func (p *BabblerPlugin) Message(message msg.Message) bool {
saidWhat, saidSomething = p.getBabbleWithSuffix(tokens) saidWhat, saidSomething = p.getBabbleWithSuffix(tokens)
} else if numTokens >= 2 && tokens[1] == "says-middle-out" { } else if numTokens >= 2 && tokens[1] == "says-middle-out" {
saidWhatStart, saidSomethingStart := p.getBabbleWithSuffix(tokens) 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 saidSomething = saidSomethingStart
saidWhat = saidWhatStart saidWhat = saidWhatStart
} else { } else {

View File

@ -262,7 +262,7 @@ func TestBabblerBadMiddleOutSeed(t *testing.T) {
res = c.Message(makeMessage("!seabass says-middle-out anything true")) res = c.Message(makeMessage("!seabass says-middle-out anything true"))
assert.Len(t, mb.Messages, 1) assert.Len(t, mb.Messages, 1)
assert.True(t, res) 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'")
} }