(code: string, check: (cg: CodeGraph) => void)
| 92 | } |
| 93 | |
| 94 | async function withIndex(code: string, check: (cg: CodeGraph) => void): Promise<void> { |
| 95 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-pascal-chain-')); |
| 96 | try { |
| 97 | fs.writeFileSync(path.join(dir, 'Unit1.pas'), code); |
| 98 | const cg = await CodeGraph.init(dir, { index: true }); |
| 99 | try { |
| 100 | check(cg); |
| 101 | } finally { |
| 102 | cg.close(); |
| 103 | } |
| 104 | } finally { |
| 105 | fs.rmSync(dir, { recursive: true, force: true }); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | function edgesFrom(cg: CodeGraph, sourceName: string): string[] { |
| 110 | const source = cg.getNodesByKind('function').concat(cg.getNodesByKind('method')).find((n) => n.name === sourceName); |
no test coverage detected