MCPcopy Create free account
hub / github.com/github/gh-aw / TestEscapeGraphQLString

Function TestEscapeGraphQLString

pkg/cli/project_command_test.go:39–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestEscapeGraphQLString(t *testing.T) {
40 tests := []struct {
41 name string
42 input string
43 expected string
44 }{
45 {
46 name: "plain text",
47 input: "Hello World",
48 expected: "Hello World",
49 },
50 {
51 name: "with quotes",
52 input: `Project "Alpha"`,
53 expected: `Project \"Alpha\"`,
54 },
55 {
56 name: "with backslash",
57 input: `Path\to\file`,
58 expected: `Path\\to\\file`,
59 },
60 {
61 name: "with newline",
62 input: "Line 1\nLine 2",
63 expected: "Line 1\\nLine 2",
64 },
65 {
66 name: "with tab",
67 input: "Name\tValue",
68 expected: "Name\\tValue",
69 },
70 {
71 name: "complex string",
72 input: "Test \"project\"\nWith\ttabs\\and backslashes",
73 expected: "Test \\\"project\\\"\\nWith\\ttabs\\\\and backslashes",
74 },
75 }
76
77 for _, tt := range tests {
78 t.Run(tt.name, func(t *testing.T) {
79 result := escapeGraphQLString(tt.input)
80 assert.Equal(t, tt.expected, result, "GraphQL string should be properly escaped")
81 })
82 }
83}
84
85func TestProjectConfig(t *testing.T) {
86 tests := []struct {

Callers

nothing calls this directly

Calls 2

escapeGraphQLStringFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected