More work on repeated string summarization.

This commit is contained in:
Storm Dragon committed 2026-10-29 14:45:51 -04:00
1 parent 3cf41e662c
commit 47f18fdd28
7 files changed
+122 -34

No files matched your search

+18 -10
View File
@@ -75,16 +75,24 @@ func TestPackageProgressBarSpeechKeepsOriginalClipboardText(t *testing.T) {
settings.Reading.RepeatedSymbols = true
voice := &fakeVoice{}
echo := &echoSpeaker{Speaker: voice, punctuation: processor, punctuationLevel: "some", settings: &settings}
text := "(123/189) upgrading nodejs-lts-jod" + strings.Repeat(" ", 157) + "[" + strings.Repeat("#", 120) + "] 100%"
echo.Say(text)
if len(voice.messages) != 1 {
t.Fatal("missing progress speech", voice.messages)
}
if got := strings.Join(strings.Fields(voice.messages[0]), " "); got != "123 slash 189 upgrading nodejs dash lts dash jod 120 number 100" {
t.Fatal("progress bar did not summarize", got)
}
if echo.last != text {
t.Fatal("clipboard echo lost original progress bar", echo.last)
for _, trial := range []struct{ bar, want string }{
{strings.Repeat("#", 120), "120 number"},
{strings.Repeat("#", 110) + strings.Repeat("-", 10), "110 number 10 dash"},
{strings.Repeat("#", 90) + strings.Repeat("-", 10), "90 number 10 dash"},
} {
voice.messages = nil
text := "(123/189) upgrading nodejs-lts-jod" + strings.Repeat(" ", 157) + "[" + trial.bar + "] 100%"
echo.Say(text)
if len(voice.messages) != 1 {
t.Fatal("missing progress speech", voice.messages)
}
want := "123 slash 189 upgrading nodejs dash lts dash jod " + trial.want + " 100 percent"
if got := strings.Join(strings.Fields(voice.messages[0]), " "); got != want {
t.Fatal("progress bar did not summarize", got)
}
if echo.last != text {
t.Fatal("clipboard echo lost original progress bar", echo.last)
}
}
}