func TestUnmarshalGraphQL_arrayReset(t *testing.T) {
	t.Parallel()
	got := []string{"initial"}
	err := graphqljson.UnmarshalData([]byte(`["bar", "baz"]`), &got)
	if err != nil {
		t.Fatal(err)
	}
	want := []string{"bar", "baz"}
	if diff := cmp.Diff(got, want); diff != "" {
		t.Error(diff)
	}
}
When unmarshaling into an array, its initial value should be overwritten
(rather than appended to).
package graphqljson_test
import (
	"encoding/json"
	"testing"
	"time"
	"github.com/google/go-cmp/cmp"
	"github.com/Yamashou/gqlgenc/graphqljson"
)
func TestUnmarshalGraphQL(t *testing.T) {
	t.Parallel()
	type query struct {
		Me struct {
			Name   string
			Height float64
		}
	}
	var got query
	err := graphqljson.UnmarshalData([]byte(`{
		"me": {
			"name": "Luke Skywalker",
			"height": 1.72
		}
	}`), &got)
	if err != nil {
		t.Fatal(err)
	}
	var want query
	want.Me.Name = "Luke Skywalker"
	want.Me.Height = 1.72
	if diff := cmp.Diff(got, want); diff != "" {
		t.Error(diff)
	}
}
func TestUnmarshalGraphQL_graphqlTag(t *testing.T) {
	t.Parallel()
	type query struct {
		Foo string `graphql:"baz"`
	}
	var got query
	err := graphqljson.UnmarshalData([]byte(`{
		"baz": "bar"
	}`), &got)
	if err != nil {
		t.Fatal(err)
	}
	want := query{
		Foo: "bar",
	}
	if diff := cmp.Diff(got, want); diff != "" {
		t.Error(diff)
	}
}
func TestUnmarshalGraphQL_jsonTag(t *testing.T) {
	t.Parallel()
	type query struct {
		Foo string `json:"baz"`
	}
	var got query
	err := graphqljson.UnmarshalData([]byte(`{
		"foo": "bar"
	}`), &got)
	if err != nil {
		t.Fatal(err)
	}
	want := query{
		Foo: "bar",
	}
	if diff := cmp.Diff(got, want); diff != "" {
		t.Error(diff)
	}
}
func TestUnmarshalGraphQL_array(t *testing.T) {
	t.Parallel()
	type query struct {
		Foo []string
		Bar []string
		Baz []string
	}
	var got query
	err := graphqljson.UnmarshalData([]byte(`{
		"foo": [
			"bar",
			"baz"
		],
		"bar": [],
		"baz": null
	}`), &got)
	if err != nil {
		t.Fatal(err)
	}
	want := query{
		Foo: []string{"bar", "baz"},
		Bar: []string{},
		Baz: []string(nil),
	}
	if diff := cmp.Diff(got, want); diff != "" {
		t.Error(diff)
	}
}