github.com/haraldrudell/parl@v0.4.176/pslices/stringify-slice_test.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pslices
     7  
     8  import (
     9  	"testing"
    10  
    11  	"golang.org/x/exp/slices"
    12  )
    13  
    14  func TestSliceStringify(t *testing.T) {
    15  	byts := []byte{0}
    16  	exp := []string{"0"}
    17  
    18  	var sList []string
    19  
    20  	if sList = StringifySlice[int](nil); sList != nil {
    21  		t.Error("nil non-nil")
    22  	}
    23  
    24  	if sList = StringifySlice(byts); slices.Compare(sList, exp) != 0 {
    25  		t.Errorf("bad result: %v exp %v", sList, exp)
    26  	}
    27  }