You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
565 B

package PinYinUtil
import (
"testing"
)
func TestConvert(t *testing.T) {
str, err := New("hi,黄海").Split("").Mode(InitialsInCapitals).Convert()
if err != nil {
t.Error(err)
} else {
t.Log(str)
}
str, err = New("hi, 吴缤").Split(" ").Mode(WithoutTone).Convert()
if err != nil {
t.Error(err)
} else {
t.Log(str)
}
str, err = New("郑丽花").Split("-").Mode(Tone).Convert()
if err != nil {
t.Error(err)
} else {
t.Log(str)
}
str, err = New("我是h中国人a").Convert()
if err != nil {
t.Error(err)
} else {
t.Log(str)
}
}