Files
go-easy-utils/strx/to_byte_test.go
2025-07-08 15:26:54 +08:00

24 lines
406 B
Go

package strx
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestToBytes(t *testing.T) {
testCases := []struct {
name string
input string
expected []byte
}{
{"转换hello", "hello", []byte{0x68, 0x65, 0x6c, 0x6c, 0x6f}},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
res := ToBytes(tc.input)
assert.Equal(t, tc.expected, res)
})
}
}