github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/xstring/convert_test.go (about)

     1  package xstring
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestBytesToString(t *testing.T) {
    10  	data := []byte("Hello world!")
    11  	got := FromBytes(data)
    12  	want := string(data)
    13  
    14  	assert.Equal(t, want, got)
    15  }
    16  
    17  func TestStringToBytes(t *testing.T) {
    18  	data := "Hello world!"
    19  	got := ToBytes(data)
    20  	want := []byte(data)
    21  
    22  	assert.Equal(t, want, got)
    23  }