2026-03-07 05:30:18 +07:00

73 lines
1.0 KiB
Go

package cleaner
import (
"fmt"
"testing"
)
func Test_service_ClearCode(t *testing.T) {
tests := []struct {
code string
want string
}{
{
code: "ы",
want: "ы",
},
{
code: "Ы",
want: "ы",
},
{
code: "Ы-1",
want: "ы1",
},
{
code: "[Ы]",
want: "ы",
},
{
code: "([Ы])",
want: "ы",
},
}
for _, tt := range tests {
t.Run(fmt.Sprintf("%s->%s", tt.code, tt.want), func(t *testing.T) {
var s service
got := s.ClearCode(tt.code)
if got != tt.want {
t.Errorf("ClearCode() = %v, want %v", got, tt.want)
}
})
}
}
func Test_service_ClearText(t *testing.T) {
tests := []struct {
text string
want string
}{
{
text: "text",
want: "text",
},
{
text: "text ([Ы])",
want: "text",
},
{
text: "text ([Ы-3])",
want: "text",
},
}
for _, tt := range tests {
t.Run(tt.text, func(t *testing.T) {
var s service
got := s.ClearText(tt.text)
if got != tt.want {
t.Errorf("ClearText() = %v, want %v", got, tt.want)
}
})
}
}