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

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