18 lines
334 B
Go
18 lines
334 B
Go
package str
|
|
|
|
import "testing"
|
|
|
|
func TestConv(t *testing.T) {
|
|
tmp := "测试字符"
|
|
bs := []byte("测试字符")
|
|
t.Run("byte -> string", func(t *testing.T) {
|
|
t.Log(B2S(bs))
|
|
})
|
|
t.Run("string -> byte", func(t *testing.T) {
|
|
t.Log(S2B(tmp))
|
|
})
|
|
t.Run("string -> byte -> string", func(t *testing.T) {
|
|
t.Log(B2S(S2B(tmp)))
|
|
})
|
|
}
|