github.com/Finschia/finschia-sdk@v0.48.1/x/params/types/deref_test.go (about)

     1  package types
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func TestKeyTableUnfurlsPointers(t *testing.T) {
    11  	tbl := NewKeyTable()
    12  	validator := func(_ interface{}) error {
    13  		return nil
    14  	}
    15  	tbl = tbl.RegisterType(ParamSetPair{
    16  		Key:         []byte("key"),
    17  		Value:       (*****string)(nil),
    18  		ValidatorFn: validator,
    19  	})
    20  
    21  	got := tbl.m["key"]
    22  	want := attribute{
    23  		vfn: validator,
    24  		ty:  reflect.ValueOf("").Type(),
    25  	}
    26  	require.Equal(t, got.ty, want.ty)
    27  }