func TestResolvePrimitiveCodegen_PtrDeref(t *testing.T) {
	rprim := &primitiveResolver{
		ptrDepth: 3,
		primKind: proto.RGQLPrimitive_PRIMITIVE_KIND_INT,
	}
	stmts, err := rprim.GenerateGoASTRef()
	if err != nil {
		t.Fatal(err.Error())
	}
	if len(stmts) != 7 {
		t.Fatalf("expected 7 stmt, got %d", len(stmts))
	}
	testASTCodegen(
		t,
		stmts,
		primIntPtrDerefExpectedOut,
	)
}
TestResolvePrimitiveCodegen_PtrDeref checks the Go output of the primitive resolver.
Multiple variable dereferences are requested.
package analysis
import (
	gtypes "go/types"
	"testing"
	"github.com/graphql-go/graphql/language/ast"
	"github.com/rgraphql/magellan/schema"
	proto "github.com/rgraphql/rgraphql"
	"golang.org/x/tools/go/loader"
)
const primBoolExpectedOut = `package test-output
func resolve() {
	resolver.ResolveValue(rctx, true, func() *resolver.Value {
		return resolver.BuildBoolValue(v)
	})
}
`
func TestResolvePrimitiveCodegen(t *testing.T) {
	rprim := &primitiveResolver{
		primKind: proto.RGQLPrimitive_PRIMITIVE_KIND_BOOL,
	}
	stmts, err := rprim.GenerateGoASTRef()
	if err != nil {
		t.Fatal(err.Error())
	}
	if len(stmts) != 1 {
		t.Fatalf("expected 1 stmt, got %d", len(stmts))
	}
	testASTCodegen(
		t,
		stmts,
		primBoolExpectedOut,
	)
}
const primIntPtrDerefExpectedOut = `package test-output
func resolve() {
	if v == nil {
		return resolver.BuildNullValue()
	}
	v1 := *v
	if v1 == nil {
		return resolver.BuildNullValue()
	}
	v2 := *v1
	if v2 == nil {
		return resolver.BuildNullValue()
	}
	v3 := *v2
	resolver.ResolveValue(rctx, true, func() *resolver.Value {
		return resolver.BuildIntValue(v3)
	})
}
`