MCPcopy
hub / github.com/sqlc-dev/sqlc / TestParseQueryFlags

Function TestParseQueryFlags

internal/metadata/meta_test.go:103–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestParseQueryFlags(t *testing.T) {
104 for _, comments := range [][]string{
105 {
106 " name: CreateFoo :one",
107 " @flag-foo",
108 },
109 {
110 " name: CreateFoo :one ",
111 "@flag-foo ",
112 },
113 {
114 " name: CreateFoo :one",
115 " @flag-foo @flag-bar",
116 },
117 {
118 " name: GetFoos :many",
119 " @param @flag-bar UUID",
120 " @flag-foo",
121 },
122 {
123 " name: GetFoos :many",
124 " @flag-foo",
125 " @param @flag-bar UUID",
126 },
127 } {
128 _, flags, _, err := ParseCommentFlags(comments)
129 if err != nil {
130 t.Errorf("expected comments to parse, got err: %s", err)
131 }
132
133 if !flags["@flag-foo"] {
134 t.Errorf("expected flag not found")
135 }
136
137 if flags["@flag-bar"] {
138 t.Errorf("unexpected flag found")
139 }
140 }
141}
142
143func TestParseQueryRuleSkiplist(t *testing.T) {
144 for _, comments := range [][]string{

Callers

nothing calls this directly

Calls 1

ParseCommentFlagsFunction · 0.85

Tested by

no test coverage detected