MCPcopy Index your code
hub / github.com/google/mangle / TestDescrCheckingNegative

Function TestDescrCheckingNegative

analysis/declcheck_test.go:214–253  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

212}
213
214func TestDescrCheckingNegative(t *testing.T) {
215 tests := []struct {
216 name string
217 descrAtoms []ast.Atom
218 }{
219 {
220 name: "empty doc atom",
221 descrAtoms: []ast.Atom{ast.NewAtom("doc"), argAtomBar, argAtomBaz},
222 },
223 {
224 name: "bad doc atom",
225 descrAtoms: []ast.Atom{ast.NewAtom("doc", ast.Number(42)), argAtomBar, argAtomBaz},
226 },
227 {
228 name: "missing argdoc",
229 descrAtoms: []ast.Atom{docAtomOne, argAtomBar},
230 },
231 {
232 name: "too many argdoc",
233 descrAtoms: []ast.Atom{docAtomOne, argAtomBar, argAtomBaz, argAtomBaz},
234 },
235 {
236 name: "wrong argdoc",
237 descrAtoms: []ast.Atom{
238 docAtomOne,
239 argAtomBar,
240 ast.NewAtom("arg", ast.Variable{"Wrong"}, ast.String("an arg docu for Wrong")),
241 },
242 },
243 }
244
245 for _, test := range tests {
246 t.Run(test.name, func(t *testing.T) {
247 c := newDeclChecker(mustDecl(test.descrAtoms, nil, nil))
248 if errs := c.check(); errs == nil {
249 t.Errorf("%s: expected error for %+v", test.name, c.decl)
250 }
251 })
252 }
253}

Callers

nothing calls this directly

Calls 6

NewAtomFunction · 0.92
NumberFunction · 0.92
StringFunction · 0.92
newDeclCheckerFunction · 0.85
mustDeclFunction · 0.85
checkMethod · 0.45

Tested by

no test coverage detected