(typeName: string, file: string)
| 1541 | cg = await CodeGraph.init(tempDir, { index: true }); |
| 1542 | |
| 1543 | const methodsOf = (typeName: string, file: string): string[] => { |
| 1544 | const node = cg |
| 1545 | .getNodesByKind('struct') |
| 1546 | .find((n) => n.name === typeName && n.filePath.replace(/\\/g, '/') === file); |
| 1547 | expect(node, `${typeName} @ ${file}`).toBeDefined(); |
| 1548 | return cg |
| 1549 | .getOutgoingEdges(node!.id) |
| 1550 | .filter((e) => e.kind === 'contains') |
| 1551 | .map((e) => cg.getNode(e.target)) |
| 1552 | .filter((n) => !!n && n.kind === 'method') |
| 1553 | .map((n) => n!.name) |
| 1554 | .sort(); |
| 1555 | }; |
| 1556 | |
| 1557 | // Cross-file (non-generic) methods now attach to their struct. |
| 1558 | expect(methodsOf('Box', 'box.go')).toEqual(['Get', 'Set']); |
no test coverage detected