2026-03-02 03:15:36 +07:00

42 lines
827 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package formatter
import "testing"
func Test_service_FormatText(t *testing.T) {
tests := []struct {
name string
text string
want string
}{
{
name: "Простой текст",
text: "Привет",
want: "Привет",
},
{
name: "Текст с двумя абзацами",
text: "Привет\nМир",
want: "Привет\n Мир",
},
{
name: "Прямая речь",
text: "— Привет",
want: " — Привет",
},
{
name: "Прямая речь через 2 минуса",
text: "-- Привет",
want: " — Привет",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var s service
got := s.FormatText(tt.text)
if got != tt.want {
t.Errorf("FormatText() = %v, want %v", got, tt.want)
}
})
}
}