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

Function assertParity

__tests__/kernel-rustlang-parity.test.ts:75–91  ·  view source on GitHub ↗
(filePath: string, source: string, minNodes = 3)

Source from the content-addressed store, hash-verified

73 });
74
75 function assertParity(filePath: string, source: string, minNodes = 3): void {
76 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
77 delete process.env.CODEGRAPH_KERNEL;
78 const viaKernel = tryKernelExtract(filePath, source, 'rust');
79 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
80
81 process.env.CODEGRAPH_KERNEL = '0';
82 const viaWasm = extractFromSource(filePath, source, 'rust');
83 delete process.env.CODEGRAPH_KERNEL;
84
85 const k = canon(viaKernel!);
86 const w = canon(viaWasm);
87 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
88 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
89 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
90 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
91 }
92
93 it('torture fixture: impl/trait quirks, use bindings, chains, fn-refs, value-refs, route macros', () => {
94 const file = path.join(FIXTURE_DIR, 'torture.rs');

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected