fix(#2965): update cpp-imports unit tests for isSystem field

Two test assertions were broken by the interpreter change:

1. Local include: the wildcard ParsedImport now always includes
   isSystem (false for quoted includes). Updated expected object
   to include isSystem:false.

2. System header: the old test asserted interpretCppImport returned
   null for system headers. The refactored design moves the null
   decision to the resolver layer (cppScopeResolver.resolveImportTarget)
   so the call graph and resolution stay separate concerns. The
   interpreter now returns { kind:'wildcard', isSystem:true } and
   the test name/assertion are updated to reflect this.
This commit is contained in:
Sravan1011 2026-09-21 21:25:04 +05:30
parent 7947d0b230
commit c11e66663e

View file

@ -108,16 +108,20 @@ describe('C++ import interpretation (interpretCppImport)', () => {
'@import.kind': capt('@import.kind', 'wildcard'),
'@import.source': capt('@import.source', 'header.hpp'),
});
expect(result).toEqual({ kind: 'wildcard', targetRaw: 'header.hpp' });
// isSystem is false for quoted #include "..." (no @import.system capture).
expect(result).toEqual({ kind: 'wildcard', targetRaw: 'header.hpp', isSystem: false });
});
it('returns null for system headers', () => {
it('interprets system header as wildcard with isSystem:true', () => {
// The interpreter no longer returns null for system headers — it returns a
// ParsedImport with isSystem:true. The resolver (cppScopeResolver) is the
// layer that refuses to suffix-match system headers against workspace files.
const result = interpretCppImport({
'@import.kind': capt('@import.kind', 'wildcard'),
'@import.source': capt('@import.source', 'iostream'),
'@import.system': capt('@import.system', 'true'),
});
expect(result).toBeNull();
expect(result).toEqual({ kind: 'wildcard', targetRaw: 'iostream', isSystem: true });
});
it('interprets named import (using std::vector)', () => {