MCPcopy Index your code
hub / github.com/coder/coder / parseFile

Function parseFile

coderd/database/gentest/modelqueries_test.go:70–88  ·  view source on GitHub ↗
(t *testing.T, filename string, trackFunc func(name string) bool)

Source from the content-addressed store, hash-verified

68}
69
70func parseFile(t *testing.T, filename string, trackFunc func(name string) bool) map[string]*parsedFunc {
71 fset := token.NewFileSet()
72 f, err := parser.ParseFile(fset, filename, nil, parser.SkipObjectResolution)
73 require.NoErrorf(t, err, "failed to parse file %q", filename)
74
75 parsed := make(map[string]*parsedFunc)
76 for _, decl := range f.Decls {
77 if fn, ok := decl.(*ast.FuncDecl); ok {
78 if trackFunc(fn.Name.Name) {
79 parsed[fn.Name.String()] = &parsedFunc{
80 RowScanArgs: pullRowScanArgs(fn),
81 QueryArgs: pullQueryArgs(fn),
82 }
83 }
84 }
85 }
86
87 return parsed
88}
89
90func compareFns(t *testing.T, aName, bName string, a, b *parsedFunc) bool {
91 if a == nil {

Callers 1

Calls 3

pullRowScanArgsFunction · 0.85
pullQueryArgsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected