0110e9bc8c
From a real reply in a nudge eval run: "Смотрите на его потребление воды" is a plural imperative AND third person about him. Only the plural printed. Two separate faults. The check returned on its first hit, so the second break stayed invisible and the failure read as milder than it was; it now joins them. And "его" was not detected at all — looksVerb knows the -й/-йте imperative but not the -те plural, so "смотрите" counted as the person being talked about, which is what an antecedent means here. pluralVerb already knows that form, so the antecedent test uses it too. Third time a verb form has blinded this check. A fourth means it wants a morphology table rather than another suffix.
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package eval
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestAddressReportsEveryBreak — the real reply from a nudge eval run broke in
|
|
// two ways at once and the check named only the plural. Both must print: a
|
|
// half-reported failure reads as a milder problem than it is.
|
|
func TestAddressReportsEveryBreak(t *testing.T) {
|
|
body := "Смотрите на его потребление воды."
|
|
res := checkAddress(body)
|
|
if res.Pass {
|
|
t.Fatalf("checkAddress passed %q", body)
|
|
}
|
|
for _, want := range []string{"смотрите", "его"} {
|
|
if !strings.Contains(res.Detail, want) {
|
|
t.Errorf("detail %q does not name %q", res.Detail, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// One word repeated is one problem, so the detail must not say it twice.
|
|
func TestAddressDeduplicates(t *testing.T) {
|
|
res := checkAddress("Вам стоит поесть, вам это нужно.")
|
|
if res.Pass {
|
|
t.Fatal("expected failure")
|
|
}
|
|
if n := strings.Count(res.Detail, "formal"); n != 1 {
|
|
t.Errorf("detail repeats the same break %d times: %q", n, res.Detail)
|
|
}
|
|
}
|