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.
This commit is contained in:
Navid EMAD 2026-08-18 05:13:58 +02:00
parent 4674308b9f
commit 889da858d1
No known key found for this signature in database

View file

@ -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 () => {