Files
Maven/internal/phraser/confirm_lines_test.go
claude 33032b859a strings family 5: the confirmation answers move, the prompt does not (V-505)
The task asked to decide first whether this family should move at all. It
moves, but only half of it, and the half that stays put is the important one.

The prompt is already in acts_ru_v1.json. act_confirm and act_confirm_entity
went there with family 4, which is where they belong: the sentence he has to
hear before he says yes is an act line, and it loads with {name} required, so a
variant that dropped the capability cannot exist. Nothing about that needed
redoing.

What was left in cmd/mavend/confirm.go is the answers. Those are now
confirm_ru_v1.json: cancelled, the two routine answers, and the four
propose-gap lines. Every entry is fixed at one wording. He answered a question
about one specific thing, so variety buys nothing here and costs the property
that matters, which is that the same act reports the same outcome every time.
The three propose lines that name the verb have {name} required, for the same
reason the prompt does.

Two literals also stopped being duplicates. The confirmed tool run said
"готово." and "не получилось выполнить команду." word for word from the acts
family, so it now reports through ActDone and ActFail rather than keeping a
second copy to drift from.

Family 5 was the last one open. The persona scorer sweeps the new variants with
the other five, and the single-variant-means-fixed test now covers it.
2026-08-05 16:07:50 +04:00

52 lines
1.8 KiB
Go

package phraser
import (
"math/rand"
"strings"
"testing"
)
// The confirmation family has the strictest constraints of the six, so they are
// tested rather than left to the doc comment (Vikunja #505).
func TestConfirmFamilyLoads(t *testing.T) {
c, err := LoadConfirms(rand.NewSource(1))
if err != nil {
t.Fatalf("LoadConfirms: %v", err)
}
if got := len(c.Variants()); got != len(confirmKeys) {
t.Errorf("variants %d, want %d: every entry is fixed at one wording", got, len(confirmKeys))
}
}
// A propose line that lost {name} would tell him a command is not allowed
// without saying which one, which is the whole content of the line.
func TestEveryProposeLineNamesTheVerb(t *testing.T) {
for _, key := range []string{ProposeFailed, ProposeNew, ProposeAlready} {
got := C(key, map[string]string{"name": "перезагрузи"})
if !strings.Contains(got, "перезагрузи") {
t.Errorf("%s: %q does not name the verb", key, got)
}
}
}
// A spoken yes does not accept a routine. The line has to keep saying where the
// acceptance happens, or he hears agreement and gets no reminders.
func TestRoutineYesStillPointsAtThePage(t *testing.T) {
got := C(ConfirmRoutineAuthed, nil)
if !strings.Contains(got, "рутин") {
t.Errorf("%q does not name the routines page", got)
}
}
// The floor answers when the file will not load, so the deck can never leave a
// confirmed act with nothing to say.
func TestConfirmFloorAnswersWithoutTheFile(t *testing.T) {
var c *Confirms
if got := c.Say(ConfirmCancelled, nil); got != confirmFloor[ConfirmCancelled] {
t.Errorf("nil deck: %q, want the floor line", got)
}
if got := c.Say(ProposeFailed, map[string]string{"name": "стоп"}); !strings.Contains(got, "стоп") {
t.Errorf("nil deck: %q does not name the verb", got)
}
}