github.com/haraldrudell/parl@v0.4.176/pslices/resolve-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 TestResolveSlice(t *testing.T) {
    15  	v1 := 1
    16  	v1p := &v1
    17  	slic := []*int{v1p}
    18  	slicResolved := []int{v1}
    19  
    20  	var actual []int
    21  
    22  	ResolveSlice[int](nil)
    23  	actual = ResolveSlice(slic)
    24  	if slices.Compare(actual, slicResolved) != 0 {
    25  		t.Errorf("bad slice: %v exp %v", actual, slicResolved)
    26  	}
    27  }