github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/reflect2/test/slice_string_test.go (about)

     1  package test
     2  
     3  import (
     4  	"testing"
     5  	"github.com/v2pro/plz/reflect2"
     6  )
     7  
     8  func Test_slice_string(t *testing.T) {
     9  	t.Run("SetIndex", testOp(func(api reflect2.API) interface{} {
    10  		obj := []string{"hello", "world"}
    11  		valType := api.TypeOf(obj).(reflect2.SliceType)
    12  		valType.SetIndex(&obj, 0, "hi")
    13  		valType.SetIndex(&obj, 1, "there")
    14  		return obj
    15  	}))
    16  }