generated from VLADIMIR/template
add cleaner tests
This commit is contained in:
parent
2bc2bf45c7
commit
ccc4f126f6
@ -1,6 +1,5 @@
|
|||||||
package cleaner
|
package cleaner
|
||||||
|
|
||||||
type ICleaner interface {
|
type ICleaner interface {
|
||||||
// ([Ы-1]) -> ы1, Ы-1 -> ы1
|
|
||||||
ClearCode(code string) string
|
ClearCode(code string) string
|
||||||
}
|
}
|
||||||
|
|||||||
43
internal/modules/cleaner/service_test.go
Normal file
43
internal/modules/cleaner/service_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user