(typeName: string, file: string)
| 1770 | cg = await CodeGraph.init(tempDir, { index: true }); |
| 1771 | |
| 1772 | const methodsOf = (typeName: string, file: string): string[] => { |
| 1773 | const node = cg |
| 1774 | .getNodesByKind('struct') |
| 1775 | .find((n) => n.name === typeName && n.filePath.replace(/\\/g, '/') === file); |
| 1776 | expect(node, `${typeName} @ ${file}`).toBeDefined(); |
| 1777 | return cg |
| 1778 | .getOutgoingEdges(node!.id) |
| 1779 | .filter((e) => e.kind === 'contains') |
| 1780 | .map((e) => cg.getNode(e.target)) |
| 1781 | .filter((n) => !!n && n.kind === 'method') |
| 1782 | .map((n) => n!.name) |
| 1783 | .sort(); |
| 1784 | }; |
| 1785 | |
| 1786 | // Cross-file (non-generic) methods now attach to their struct. |
| 1787 | expect(methodsOf('Box', 'box.go')).toEqual(['Get', 'Set']); |
no test coverage detected