1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 22:52:29 +08:00

doc: add example for strutil new functions

This commit is contained in:
dudaodong
2023-04-17 16:35:26 +08:00
parent 04abb7a3ea
commit 66bd339e3a
2 changed files with 85 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
package strutil
import (
"github.com/duke-git/lancet/v2/internal"
"reflect"
"testing"
"github.com/duke-git/lancet/v2/internal"
)
func TestCamelCase(t *testing.T) {
@@ -350,15 +351,15 @@ func TestRemoveNonPrintable(t *testing.T) {
assert.Equal("你好😄", RemoveNonPrintable("你好😄"))
}
func TestString2Bytes(t *testing.T) {
assert := internal.NewAssert(t, "TestString2Bytes")
func TestStringToBytes(t *testing.T) {
assert := internal.NewAssert(t, "TestStringToBytes")
str := "abc"
bytes := StringToBytes(str)
assert.Equal(reflect.DeepEqual(bytes, []byte{'a', 'b', 'c'}), true)
}
func TestBytes2String(t *testing.T) {
assert := internal.NewAssert(t, "TestBytes2String")
func TestBytesToString(t *testing.T) {
assert := internal.NewAssert(t, "TestBytesToString")
bytes := []byte{'a', 'b', 'c'}
str := BytesToString(bytes)
assert.Equal(str == "abc", true)