mirror of https://github.com/velour/catbase.git
Fixed tea regex to fix bad matches that ended in iced
Added a test based on skiesel's quote that triggered it.
This commit is contained in:
parent
6917e091af
commit
ae3a4eee52
|
@ -136,7 +136,7 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if tea, _ := regexp.MatchString("(?i)^tea\\. [0-9A-Za-z_ ]*\\. (hot)|(iced)\\.?$", message.Body); tea {
|
if tea, _ := regexp.MatchString("(?i)^tea\\. [0-9A-Za-z_ ]*\\. ((hot)|(iced))\\.?$", message.Body); tea {
|
||||||
item, err := GetItem(p.DB, nick, "🍵")
|
item, err := GetItem(p.DB, nick, "🍵")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error finding item %s.%s: %s.", nick, "🍵", err)
|
log.Printf("Error finding item %s.%s: %s.", nick, "🍵", err)
|
||||||
|
|
|
@ -60,6 +60,16 @@ func TestTeaUnrelated(t *testing.T) {
|
||||||
assert.Equal(t, 0, item.Count)
|
assert.Equal(t, 0, item.Count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTeaSkieselQuote(t *testing.T) {
|
||||||
|
mb := bot.NewMockBot()
|
||||||
|
c := New(mb)
|
||||||
|
assert.NotNil(t, c)
|
||||||
|
c.Message(makeMessage("blah, this is a whole page of explanation where \"we did local search and used a tabu list\" would have sufficed"))
|
||||||
|
item, err := GetItem(mb.DB(), "tester", "🍵")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, 0, item.Count)
|
||||||
|
}
|
||||||
|
|
||||||
func TestResetMe(t *testing.T) {
|
func TestResetMe(t *testing.T) {
|
||||||
mb := bot.NewMockBot()
|
mb := bot.NewMockBot()
|
||||||
c := New(mb)
|
c := New(mb)
|
||||||
|
|
Loading…
Reference in New Issue