mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-07 02:58:02 +00:00
test(lua): complete grammar coverage, ABI smoke, and docs
Follow-up to 4c8937b (feat: add Lua language support) — wire Lua into the test and doc surface the feature commit omitted. - grammar-update-monitor: GRAMMARS registry now asserts six grammars (swift/kotlin/lua/c npm, dart/proto github) and that lua.hold is set; the vendored nan-based binding is incompatible with the pinned tree-sitter@0.21.1 runtime and must not auto-bump. - language-skip: Lua is available in the default install (vendored grammar), unlike the optional Kotlin dependency. - parser-loader-abi: add a Lua smoke case (root type `chunk`). - parsing: drop the stale assertion that getLanguageFromFilename returns null for `module.lua` — Lua is now registered in language-detection, so it resolves to "lua". - README: add the Lua row to the supported-languages table. Verified: tsc --noEmit clean; grammar-update-monitor, language-skip, parser-loader-abi unit suites and parsing.test.ts integration suite pass. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
This commit is contained in:
parent
6deba51db0
commit
72f982cc9d
5 changed files with 25 additions and 6 deletions
|
|
@ -580,6 +580,7 @@ GitNexus builds a complete knowledge graph of your codebase through a multi-phas
|
|||
| C | — | — | ✓ | — | ✓ | ✓ | — | ✓ | ✓ |
|
||||
| C++ | — | — | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
||||
| Dart | ✓ | — | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ |
|
||||
| Lua | ✓ | — | ✓ | ✓ | — | ✓ | — | ✓ | ✓ |
|
||||
|
||||
**Imports** — cross-file import resolution · **Named Bindings** — `import { X as Y }` / re-export tracking · **Exports** — public/exported symbol detection · **Heritage** — class inheritance, interfaces, mixins · **Type Annotations** — explicit type extraction for receiver resolution · **Constructor Inference** — infer receiver type from constructor calls (`self`/`this` resolution included for all languages) · **Config** — language toolchain config parsing (tsconfig, go.mod, etc.) · **Frameworks** — AST-based framework pattern detection · **Entry Points** — entry point scoring heuristics
|
||||
|
||||
|
|
|
|||
|
|
@ -935,9 +935,6 @@ describe('parsing', () => {
|
|||
const scalaLang = getLanguageFromFilename('Main.scala');
|
||||
expect(scalaLang).toBeNull();
|
||||
|
||||
const luaLang = getLanguageFromFilename('module.lua');
|
||||
expect(luaLang).toBeNull();
|
||||
|
||||
// loadLanguage throws an explicit error for a language not in the grammar map.
|
||||
// Cast through unknown to simulate a caller passing an unrecognised language key.
|
||||
await expect(loadLanguage('erlang' as unknown as SupportedLanguages)).rejects.toThrow(
|
||||
|
|
|
|||
|
|
@ -73,19 +73,31 @@ describe('COMPATIBLE_ABI gate', () => {
|
|||
});
|
||||
|
||||
describe('GRAMMARS registry', () => {
|
||||
it('covers all five grammars (swift/kotlin npm, dart/proto github, c npm)', () => {
|
||||
expect(Object.keys(mod.GRAMMARS).sort()).toEqual(['c', 'dart', 'kotlin', 'proto', 'swift']);
|
||||
it('covers all six grammars (swift/kotlin/lua/c npm, dart/proto github)', () => {
|
||||
expect(Object.keys(mod.GRAMMARS).sort()).toEqual([
|
||||
'c',
|
||||
'dart',
|
||||
'kotlin',
|
||||
'lua',
|
||||
'proto',
|
||||
'swift',
|
||||
]);
|
||||
expect(mod.GRAMMARS.swift.npm).toBe('tree-sitter-swift');
|
||||
expect(mod.GRAMMARS.dart.github).toContain('tree-sitter-dart');
|
||||
expect(mod.GRAMMARS.lua.npm).toBe('tree-sitter-lua');
|
||||
});
|
||||
|
||||
it('marks c and kotlin report-only (holds); swift/dart/proto are auto-updatable', () => {
|
||||
it('marks c, kotlin, lua report-only (holds); swift/dart/proto are auto-updatable', () => {
|
||||
expect(mod.GRAMMARS.c.npm).toBe('tree-sitter-c');
|
||||
expect(mod.GRAMMARS.c.hold).toBeTruthy(); // ABI-pinned: detected/reported, never auto-applied
|
||||
// kotlin is pinned to an unreleased fwcd main commit for `fun interface`
|
||||
// support (#169); npm latest (0.3.8) lacks it, so the strict-inequality
|
||||
// isNewer would auto-revert the pin without this hold.
|
||||
expect(mod.GRAMMARS.kotlin.hold).toBeTruthy();
|
||||
// lua ships nan-based bindings incompatible with the pinned tree-sitter
|
||||
// runtime; vendored with a rebuilt Napi binding, so the monitor must not
|
||||
// auto-bump until the runtime upgrades and upstream migrates to Napi.
|
||||
expect(mod.GRAMMARS.lua.hold).toBeTruthy();
|
||||
for (const k of ['swift', 'dart', 'proto']) {
|
||||
expect(mod.GRAMMARS[k].hold).toBeUndefined();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ describe('isLanguageAvailable', () => {
|
|||
expect(isLanguageAvailable(SupportedLanguages.Swift)).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for Lua in the default install (vendored grammar)', () => {
|
||||
expect(isLanguageAvailable(SupportedLanguages.Lua)).toBe(true);
|
||||
});
|
||||
|
||||
it('handles Kotlin based on optional dependency availability', () => {
|
||||
// Kotlin is now optional — result depends on whether tree-sitter-kotlin is installed
|
||||
const result = isLanguageAvailable(SupportedLanguages.Kotlin);
|
||||
|
|
|
|||
|
|
@ -112,6 +112,11 @@ const SMOKE_CASES: Record<string, SmokeCase> = {
|
|||
snippet: 'void main() {}\n',
|
||||
rootType: 'program',
|
||||
},
|
||||
[SupportedLanguages.Lua]: {
|
||||
language: SupportedLanguages.Lua,
|
||||
snippet: 'local x = 1\n',
|
||||
rootType: 'chunk',
|
||||
},
|
||||
[SupportedLanguages.Kotlin]: {
|
||||
language: SupportedLanguages.Kotlin,
|
||||
snippet: 'fun main() {}\n',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue