|
|
@@ -35,7 +35,8 @@ beforeAll(async () => {
|
|
|
Array.from({ length: CALLERS }, (_, i) => `export function caller${i}(): number { return warm(${i}); }`).join('\n') +
|
|
|
'\n'
|
|
|
);
|
|
|
- // `hot` shares its name with its file, so the answer groups per definition.
|
|
|
+ // Two real `hot` functions exercise per-definition truncation. A filename
|
|
|
+ // is not an overload of its exact-named function (#1809).
|
|
|
fs.writeFileSync(path.join(tmpDir, 'src', 'hot.ts'), 'export function hot(n: number): number { return n; }\n');
|
|
|
fs.writeFileSync(
|
|
|
path.join(tmpDir, 'src', 'hot-callers.ts'),
|
|
|
@@ -43,6 +44,10 @@ beforeAll(async () => {
|
|
|
Array.from({ length: CALLERS }, (_, i) => `export function hotCaller${i}(): number { return hot(${i}); }`).join('\n') +
|
|
|
'\n'
|
|
|
);
|
|
|
+ fs.writeFileSync(path.join(tmpDir, 'src', 'other-hot.ts'), 'export function hot(n: number): number { return n + 1; }\n');
|
|
|
+ fs.writeFileSync(path.join(tmpDir, 'src', 'other-hot-callers.ts'),
|
|
|
+ "import { hot } from './other-hot';\n" +
|
|
|
+ Array.from({ length: CALLERS }, (_, i) => `export function otherHotCaller${i}(): number { return hot(${i}); }`).join('\n') + '\n');
|
|
|
fs.writeFileSync(
|
|
|
path.join(tmpDir, 'src', 'fan.ts'),
|
|
|
Array.from({ length: CALLERS }, (_, i) => `export function helper${i}(): number { return ${i}; }`).join('\n') +
|
|
|
@@ -76,8 +81,8 @@ describe('codegraph_callers truncation', () => {
|
|
|
|
|
|
it('marks the cut inside each per-definition section too', async () => {
|
|
|
const out = await text('codegraph_callers', { symbol: 'hot' });
|
|
|
- expect(out).toContain('distinct definitions');
|
|
|
- expect(out).toMatch(/- … \+\d+ more \(pass `limit` to widen\)/);
|
|
|
+ expect(out).toContain('2 distinct definitions');
|
|
|
+ expect(out.match(/- … \+\d+ more \(pass `limit` to widen\)/g)).toHaveLength(2);
|
|
|
expect(await text('codegraph_callers', { symbol: 'hot', limit: 100 })).not.toContain('more (pass');
|
|
|
});
|
|
|
});
|