add cleaner tests

This commit is contained in:
Владимир Фёдоров 2026-03-02 02:58:26 +07:00
parent 2bc2bf45c7
commit ccc4f126f6
2 changed files with 43 additions and 1 deletions

View File

@ -1,6 +1,5 @@
package cleaner
type ICleaner interface {
// ([Ы-1]) -> ы1, Ы-1 -> ы1
ClearCode(code string) string
}

View File

@ -0,0 +1,43 @@
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)
}
})
}
}