MCPcopy
hub / github.com/dgraph-io/dgraph / TestParseMutationTooManyBlocks

Function TestParseMutationTooManyBlocks

dql/parser_test.go:4923–4955  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4921}
4922
4923func TestParseMutationTooManyBlocks(t *testing.T) {
4924 tests := []struct {
4925 m string
4926 errStr string
4927 }{
4928 {m: `
4929 {
4930 set { _:a1 <reg> "a1 content" . }
4931 }{
4932 set { _:b2 <reg> "b2 content" . }
4933 }`,
4934 errStr: "Unexpected { after the end of the block",
4935 },
4936 {m: `{set { _:a1 <reg> "a1 content" . }} something`,
4937 errStr: "Invalid operation type: something",
4938 },
4939 {m: `
4940 # comments are ok
4941 {
4942 set { _:a1 <reg> "a1 content" . } # comments are ok
4943 } # comments are ok`,
4944 },
4945 }
4946 for _, tc := range tests {
4947 mu, err := ParseMutation(tc.m)
4948 if tc.errStr != "" {
4949 require.Contains(t, err.Error(), tc.errStr)
4950 require.Nil(t, mu)
4951 } else {
4952 require.NoError(t, err)
4953 }
4954 }
4955}
4956
4957func TestParseMissingGraphQLVar(t *testing.T) {
4958 for _, q := range []string{

Callers

nothing calls this directly

Calls 2

ParseMutationFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected