github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/conf/default_setter/default_setter_test.go (about)

     1  package default_setter_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/onsi/gomega"
     7  
     8  	"github.com/machinefi/w3bstream/pkg/depends/conf/default_setter"
     9  	"github.com/machinefi/w3bstream/pkg/depends/x/ptrx"
    10  )
    11  
    12  func TestStruct(t *testing.T) {
    13  	type A struct {
    14  		A int
    15  		B float32
    16  		C *string
    17  		d string
    18  	}
    19  	dft := A{1, 2, ptrx.String("abc"), "def"}
    20  	tar := A{}
    21  	NewWithT(t).Expect(default_setter.Set(dft, &tar)).To(BeNil())
    22  	NewWithT(t).Expect(dft).To(Equal(tar))
    23  }