mirror of https://github.com/velour/catbase.git
Merge pull request #62 from velour/more_babbler_stuff
update test case to test exactly what we want
This commit is contained in:
commit
e45c335bd3
|
@ -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 {
|
||||||
|
|
|
@ -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'")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue