aa7ef33bbf
queryCalendar matched on a day word and stepped aside only on weather wording. Every world question naming a day was claimed by it and answered with an empty schedule: "какой сегодня курс доллара" replied "на 05.08.2026 ничего нет", which reads as an answer about a subject she never looked at. All four probe utterances have an answer in search, and search sits below the calendar. V-474 fixed one instance of the class. Sunset, holidays, exchange rates and world news are the same class and weather wording does not cover them. router.IsAgendaQuestion is the narrowing. Its first arm reuses AgendaQueryGrammars, so the rule that routes a question to the query chain and the rule that lets the calendar answer it cannot drift. The second reads a scheduled-thing noun, wider than the grammars because "какие встречи завтра" carries no possessive. The third claims a question that names no subject of its own. A continuation is exempt: "а завтра?" cannot name an agenda, and this is the only date-aware source there is.
42 lines
1.7 KiB
Go
42 lines
1.7 KiB
Go
package router
|
|
|
|
import "testing"
|
|
|
|
// The four utterances in Vikunja #552 plus the ones that must keep reaching
|
|
// the calendar. The list is the whole point of the predicate: every "want
|
|
// false" row was answered "на 05.08.2026 ничего нет" on the deployed daemon.
|
|
func TestIsAgendaQuestionSeparatesHisDayFromTheWorld(t *testing.T) {
|
|
tests := []struct {
|
|
utterance string
|
|
want bool
|
|
}{
|
|
// His day.
|
|
{"что у меня сегодня", true},
|
|
{"во сколько у меня встреча сегодня", true},
|
|
{"что в календаре на завтра", true},
|
|
{"какие планы на завтра", true},
|
|
{"какие встречи завтра", true},
|
|
{"когда планёрка", true},
|
|
{"покажи расписание на среду", true},
|
|
{"что дальше?", true},
|
|
// No subject of its own, so his day by default.
|
|
{"что сегодня?", true},
|
|
{"что на завтра", true},
|
|
{"что там в среду?", true},
|
|
|
|
// The world, naming a day. Every one of these is #552.
|
|
{"во сколько закат сегодня", false},
|
|
{"какой сегодня курс доллара", false},
|
|
{"какой сегодня праздник", false},
|
|
{"что интересного произошло сегодня в мире", false},
|
|
{"кто выиграл вчера матч", false},
|
|
// A day word plus a subject is never subjectless, however short.
|
|
{"что за праздник сегодня", false},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := IsAgendaQuestion(tt.utterance); got != tt.want {
|
|
t.Errorf("IsAgendaQuestion(%q) = %v, want %v", tt.utterance, got, tt.want)
|
|
}
|
|
}
|
|
}
|