GitNexus/gitnexus/test/unit/scope-resolution/cpp/cpp-member-lookup-side-channel.test.ts
azizur100389 3a4247ec36
feat(cpp): resolve inheritance-lattice member lookup (#2077)
* feat(cpp): resolve inheritance-lattice member lookup

* fix(cpp): harden inheritance-lattice lookup

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-06-09 06:53:11 +01:00

41 lines
1.2 KiB
TypeScript

import { beforeEach, describe, expect, it } from 'vitest';
import {
applyCppMemberLookupSideChannel,
clearCppMemberLookupState,
collectCppMemberLookupSideChannel,
type CppMemberLookupSideChannel,
} from '../../../../src/core/ingestion/languages/cpp/member-lookup.js';
describe('C++ member-lookup capture side-channel', () => {
beforeEach(() => {
clearCppMemberLookupState();
});
it('preserves qualified base identities through a worker-style JSON round trip', () => {
const snapshot: CppMemberLookupSideChannel = {
baseEdges: [
{
childName: 'Derived',
childQualifiedName: 'app.Derived',
baseName: 'Base',
baseQualifiedName: 'detail.Base',
isVirtual: true,
},
],
memberUsings: [
{
childName: 'Derived',
childQualifiedName: 'app.Derived',
baseName: 'Base',
baseQualifiedName: 'detail.Base',
memberName: 'select',
},
],
};
const throughWorker = JSON.parse(JSON.stringify(snapshot)) as CppMemberLookupSideChannel;
applyCppMemberLookupSideChannel('main.cpp', throughWorker);
expect(collectCppMemberLookupSideChannel('main.cpp')).toEqual(snapshot);
});
});