package main import "testing" func TestReminderBody(t *testing.T) { for _, tc := range []struct{ utterance, text, want string }{ // The row from the QA sitting: the whole utterance was the body. {"напомни завтра в 9 утра выпить таблетки", "завтра в 9 утра выпить таблетки", "выпить таблетки"}, {"напомни мне позвонить маме в семь вечера", "позвонить маме в 7 вечера", "позвонить маме"}, {"напомни через полчаса проверить бэкап", "через полчаса проверить бэкап", "проверить бэкап"}, {"remind me to call mom at 7pm", "to call mom at 7pm", "to call mom"}, // Nothing left after stripping ⇒ keep what there was. A reminder that // fires and says nothing is worse than a wordy one. {"напомни завтра", "завтра", "завтра"}, {"", "", ""}, } { if got := reminderBody(tc.utterance, tc.text); got != tc.want { t.Errorf("reminderBody(%q, %q) = %q, want %q", tc.utterance, tc.text, got, tc.want) } } }