go-easy-utils/strUtil/str_to_byte_test.go

15 lines
287 B
Go
Raw Normal View History

2023-03-23 08:27:39 +08:00
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)
}
}