package router import ( "testing" "time" ) // TestWeekdayIndexReplacesFourLists — four files kept a weekday list of their // own and each was short in a different direction (V-581). The forms below are // the ones at least one of those lists missed, so they are the point of having // one matcher: the lexicon names the day and the dictionary answers the case. func TestWeekdayIndexReplacesFourLists(t *testing.T) { for _, tc := range []struct { word string want time.Weekday }{ {"понедельник", time.Monday}, {"понедельникам", time.Monday}, {"понедельником", time.Monday}, {"вторник", time.Tuesday}, {"среда", time.Wednesday}, {"среду", time.Wednesday}, {"среде", time.Wednesday}, {"средам", time.Wednesday}, {"четверга", time.Thursday}, {"пятницу", time.Friday}, {"субботам", time.Saturday}, {"воскресеньях", time.Sunday}, {"Воскресенье", time.Sunday}, {"monday", time.Monday}, {"Fridays", time.Friday}, } { got, ok := WeekdayIndex(tc.word) if !ok || got != tc.want { t.Errorf("WeekdayIndex(%q) = %v, %v; want %v, true", tc.word, got, ok, tc.want) } } // A stem match said yes to all of these. A word match says no. for _, w := range []string{"среди", "средство", "средний", "среднем", "субботник", "", "через"} { if _, ok := WeekdayIndex(w); ok { t.Errorf("WeekdayIndex(%q) claimed a weekday", w) } } }