mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2024-05-03 11:34:53 +08:00
15 lines
287 B
Go
15 lines
287 B
Go
package strUtil
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestStrToBytes(t *testing.T) {
|
|
expected := []byte{0x68, 0x65, 0x6c, 0x6c, 0x6f}
|
|
result := StrToBytes("hello")
|
|
if !bytes.Equal(result, expected) {
|
|
t.Errorf("StrToBytes test failed, expected %v but got %v", expected, result)
|
|
}
|
|
}
|