MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / TestParseQueryRuleSkiplist

Function TestParseQueryRuleSkiplist

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

Source from the content-addressed store, hash-verified

141}
142
143func TestParseQueryRuleSkiplist(t *testing.T) {
144 for _, comments := range [][]string{
145 {
146 " name: CreateFoo :one",
147 " @sqlc-vet-disable sqlc/db-prepare delete-without-where ",
148 },
149 {
150 " name: CreateFoo :one ",
151 " @sqlc-vet-disable sqlc/db-prepare ",
152 " @sqlc-vet-disable delete-without-where ",
153 },
154 {
155 " name: CreateFoo :one",
156 " @sqlc-vet-disable sqlc/db-prepare ",
157 " update-without where",
158 " @sqlc-vet-disable delete-without-where ",
159 },
160 } {
161 _, flags, ruleSkiplist, err := ParseCommentFlags(comments)
162 if err != nil {
163 t.Errorf("expected comments to parse, got err: %s", err)
164 }
165
166 if !flags["@sqlc-vet-disable"] {
167 t.Errorf("expected @sqlc-vet-disable flag not found")
168 }
169
170 if _, ok := ruleSkiplist["sqlc/db-prepare"]; !ok {
171 t.Errorf("expected rule not found in skiplist")
172 }
173
174 if _, ok := ruleSkiplist["delete-without-where"]; !ok {
175 t.Errorf("expected rule not found in skiplist")
176 }
177
178 if _, ok := ruleSkiplist["update-without-where"]; ok {
179 t.Errorf("unexpected rule found in skiplist")
180 }
181 }
182}

Callers

nothing calls this directly

Calls 1

ParseCommentFlagsFunction · 0.85

Tested by

no test coverage detected