MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / minted

Function minted

__tests__/cpp-macro-defined-methods.test.ts:327–345  ·  view source on GitHub ↗
(kernel: boolean)

Source from the content-addressed store, hash-verified

325
326 it('is minted alike whether the kernel or the wasm extractor reads the file', () => {
327 const minted = (kernel: boolean): string[] => {
328 const saved = process.env.CODEGRAPH_KERNEL;
329 if (kernel) delete process.env.CODEGRAPH_KERNEL;
330 else process.env.CODEGRAPH_KERNEL = '0';
331 try {
332 const result = extractFromSource('src/descriptor.h', DESCRIPTOR_H, 'cpp');
333 const byId = new Map(result.nodes.map((n) => [n.id, n]));
334 return result.nodes
335 .filter((n) => n.kind === 'method' && n.signature?.includes('::'))
336 .map((n) => {
337 const holders = result.edges.filter((e) => e.kind === 'contains' && e.target === n.id).map((e) => byId.get(e.source)?.qualifiedName);
338 return `${n.id} ${n.qualifiedName} ${n.startLine}:${n.startColumn}-${n.endLine}:${n.endColumn} ${n.returnType ?? '-'} ${n.signature} <- ${holders.sort().join(',')}`;
339 })
340 .sort();
341 } finally {
342 if (saved === undefined) delete process.env.CODEGRAPH_KERNEL;
343 else process.env.CODEGRAPH_KERNEL = saved;
344 }
345 };
346 const wasm = minted(false);
347 expect(wasm).toHaveLength(7);
348 expect(minted(true)).toEqual(wasm);

Calls 4

extractFromSourceFunction · 0.90
mapMethod · 0.80
getMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected