go-easy-utils/strUtil/str_to_byte_test.go
jeffery e9cc195c39
Feature/example test (#24)
example docs
2023-04-12 15:09:44 +08:00

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)
}
}