From 889da858d182c106ddfa371138c4436934d14139 Mon Sep 17 00:00:00 2001 From: Navid EMAD Date: Tue, 18 Aug 2026 05:13:58 +0200 Subject: [PATCH] fix(zig): address fifth gitnexus-check review pass - tree-sitter-languages test: the Zig "functions, structs, enums, and imports" case now asserts the `import.source` capture for `const std = @import("std");` (the fixture's only import), so a query change that drops Zig import matching fails it instead of passing unchanged. Not re-fixed: - "Return type is read from the wrong tree-sitter field": carried over from the fourth pass unchanged. tree-sitter-zig 1.1.2 has no `return_type` field on function_declaration; the return type IS the `type` field, and the pin test added in the fourth-pass commit (zig-extractors.test.ts, `childForFieldName('return_type')` is null, `returnType` = `void` / `!*Counter`) proves it. - "`DIR_LANG` has no zig entry": carried over unchanged for the third time; the entry exists since the second-pass commit. --- .../test/integration/tree-sitter-languages.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gitnexus/test/integration/tree-sitter-languages.test.ts b/gitnexus/test/integration/tree-sitter-languages.test.ts index cdd3c155f..3c4165c2d 100644 --- a/gitnexus/test/integration/tree-sitter-languages.test.ts +++ b/gitnexus/test/integration/tree-sitter-languages.test.ts @@ -712,6 +712,17 @@ describe('Tree-sitter multi-language parsing', () => { expect(defTypes).toContain('definition.function'); expect(defTypes).toContain('definition.struct'); expect(defTypes).toContain('definition.enum'); + + // `const std = @import("std");` must yield an import.source capture — + // without this assertion a query change that drops Zig import matching + // would pass this test unchanged. + const imports: string[] = []; + for (const match of matches) { + for (const capture of match.captures) { + if (capture.name === 'import.source') imports.push(capture.node.text); + } + } + expect(imports).toEqual(['"std"']); }); it('reports Zig unavailable and throws "Unsupported language" when the grammar is absent', async () => {