github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/amino/genproto/bindings_test.go (about)

     1  package genproto
     2  
     3  import (
     4  	"bytes"
     5  	"go/printer"
     6  	"go/token"
     7  	"testing"
     8  
     9  	"github.com/gnolang/gno/tm2/pkg/amino/tests"
    10  	"github.com/stretchr/testify/assert"
    11  )
    12  
    13  func TestGenerateProtoBindings(t *testing.T) {
    14  	t.Parallel()
    15  
    16  	file, err := GenerateProtoBindingsForTypes(tests.Package, tests.Package.ReflectTypes()...)
    17  	assert.NoError(t, err)
    18  	t.Logf("%v", file)
    19  
    20  	// Print the function body into buffer buf.
    21  	// The file set is provided to the printer so that it knows
    22  	// about the original source formatting and can add additional
    23  	// line breaks where they were present in the source.
    24  	var buf bytes.Buffer
    25  	fset := token.NewFileSet()
    26  	printer.Fprint(&buf, fset, file)
    27  	t.Log(buf.String())
    28  }