github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/internal/avatar/avatar_test.go (about)

     1  package avatar
     2  
     3  import (
     4  	"fmt"
     5  	"reflect"
     6  	"testing"
     7  )
     8  
     9  type (
    10  	midWare struct {
    11  		name string
    12  	}
    13  	iMidWare interface {
    14  		String() string
    15  	}
    16  
    17  	ctrl struct {
    18  		Name    string
    19  		MidWare *midWare
    20  	}
    21  
    22  	virtulCtrl struct {
    23  		ctrl interface{}
    24  		hds  func() string
    25  	}
    26  )
    27  
    28  func TestBase(t *testing.T) {
    29  	av := New(reflect.ValueOf(&ctrl{}))
    30  	av.SetFields("world", &midWare{})
    31  	fn := av.NewCreator()
    32  	fmt.Println(fn())
    33  }