Merge pull request #62 from velour/more_babbler_stuff

update test case to test exactly what we want
This commit is contained in:
Chris Sexton 2017-06-16 18:49:12 -04:00 committed by GitHub
commit e45c335bd3
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'")
} }