(cg: CodeGraph, file: string, name: string, kinds: string[])
| 28 | |
| 29 | /** What `name`, written in `file`, links to, as `file@line` of each target, sorted. */ |
| 30 | const targetsOf = (cg: CodeGraph, file: string, name: string, kinds: string[]): string[] => { |
| 31 | const out: string[] = []; |
| 32 | for (const node of cg.getNodesInFile(file)) { |
| 33 | for (const edge of cg.getOutgoingEdges(node.id)) { |
| 34 | if (!kinds.includes(edge.kind)) continue; |
| 35 | const target = cg.getNode(edge.target)!; |
| 36 | if (target.name === name) out.push(`${target.filePath}@${target.startLine}`); |
| 37 | } |
| 38 | } |
| 39 | return [...new Set(out)].sort(); |
| 40 | }; |
| 41 | |
| 42 | describe('a name a Rust `use` binds, by the module its path walks', () => { |
| 43 | let root = ''; |
no test coverage detected