package main import "testing" // TestMentionsUnknownDayReadsWordsNotStems — the defect V-581 found. The // weekday half of this guard was a list of stems matched with strings.Contains, // so "среди", "средство" and "средний" all read as Wednesday and the question // was answered with onlyNearDaysReply instead of a date. // // The other half of the fix is coverage: a stem list stops at the forms whoever // wrote it thought of, and "воскресеньях" was not one of them. func TestMentionsUnknownDayReadsWordsNotStems(t *testing.T) { for _, u := range []string{ "какое число в понедельник", "какое число в среду", "какое число в среде", "что там по воскресеньям", "what is the date on friday", "какое число через неделю", } { if !mentionsUnknownDay(u) { t.Errorf("mentionsUnknownDay(%q) = false, want true", u) } } for _, u := range []string{ "какое число в среднем", "сколько это в среднем", "какое сегодня средство", "какое число", } { if mentionsUnknownDay(u) { t.Errorf("mentionsUnknownDay(%q) = true; it names no day", u) } } }