any_test.go 642 B

12345678910111213141516171819202122232425262728
  1. package conv_test
  2. import (
  3. "testing"
  4. "github.com/labring/aiproxy/core/common/conv"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestBytesToString(t *testing.T) {
  8. convey.Convey("BytesToString", t, func() {
  9. convey.Convey("should convert bytes to string", func() {
  10. b := []byte("hello")
  11. s := conv.BytesToString(b)
  12. convey.So(s, convey.ShouldEqual, "hello")
  13. })
  14. })
  15. }
  16. func TestStringToBytes(t *testing.T) {
  17. convey.Convey("StringToBytes", t, func() {
  18. convey.Convey("should convert string to bytes", func() {
  19. s := "hello"
  20. b := conv.StringToBytes(s)
  21. convey.So(b, convey.ShouldResemble, []byte("hello"))
  22. })
  23. })
  24. }