github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/amino/gengo/gengo_test.go (about) 1 package gengo 2 3 import ( 4 "fmt" 5 "reflect" 6 "testing" 7 8 "github.com/gnolang/gno/tm2/pkg/amino" 9 "github.com/gnolang/gno/tm2/pkg/amino/libs/press" 10 ) 11 12 type SampleStruct struct { 13 Blah1 string 14 Blah2 string 15 } 16 17 func TestBasic(t *testing.T) { 18 t.Parallel() 19 20 p := press.NewPress() 21 fmt.Println(p) 22 ss := SampleStruct{"cat", "dog"} 23 24 cdc := amino.NewCodec() 25 ssType := reflect.TypeOf(ss) 26 info, err := cdc.GetTypeInfo(ssType) 27 if err != nil { 28 panic(err) 29 } 30 PrintStructFieldEncoder(p, "b1", info.Fields[0]) 31 fmt.Println("----") 32 fmt.Println(p.Print()) 33 fmt.Println("----") 34 }