From c11e66663e929edef8c4c6e727a31c2fc990ba5c Mon Sep 17 00:00:00 2001 From: Sravan1011 Date: Mon, 21 Sep 2026 21:25:04 +0530 Subject: [PATCH] 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. --- .../test/unit/scope-resolution/cpp/cpp-imports.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gitnexus/test/unit/scope-resolution/cpp/cpp-imports.test.ts b/gitnexus/test/unit/scope-resolution/cpp/cpp-imports.test.ts index 3f2761d50..aa980622f 100644 --- a/gitnexus/test/unit/scope-resolution/cpp/cpp-imports.test.ts +++ b/gitnexus/test/unit/scope-resolution/cpp/cpp-imports.test.ts @@ -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)', () => {