aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 09:43:55 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 09:43:55 +0330
commit992f004bf31e8902744d86dee595305907144ff1 (patch)
treea202f3a9326503992bf74f87845aa854c988bc81 /tests
parentstd: add std.Io (print, println, nl, put_*, put_f, get_c, eof, read, getline)... (diff)
lsp: complete a module path one level at a time (std. lists groups, std.File. and std.Io. their members)
Diffstat (limited to 'tests')
-rw-r--r--tests/drivers/completion_test.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/drivers/completion_test.js b/tests/drivers/completion_test.js
index f1ee5e6..4b767a1 100644
--- a/tests/drivers/completion_test.js
+++ b/tests/drivers/completion_test.js
@@ -104,4 +104,15 @@ assert.match(get(r.items, 'map').documentation.value, /transform.*each element/)
assert.ok(!r.items.some(c => ['push', 'pop', 'resize'].includes(c.label)), 'library algorithms do not make a fixed array growable');
r = complete('include rt; fn main() { int[?] items = {}; items.| }');
assert.ok(!r.items.some(c => ['map', 'filter'].includes(c.label)), 'library methods require an explicit import');
-console.log('ok completion: signatures, docs, fuzzy ranking, scope, array members, shadowing and consumed lifetimes');
+r = complete('include std; fn main() { std.| }');
+for (const name of ['File', 'Io', 'Text', 'Host', 'argv', 'bnew']) get(r.items, name);
+assert.ok(!r.items.some(c => c.label.includes('.')), 'module completion lists one level: ' + r.items.filter(c => c.label.includes('.')).map(c => c.label));
+r = complete('include std; fn main() { std.File.| }');
+for (const name of ['read', 'write']) get(r.items, name);
+assert.ok(!r.items.some(c => ['Io', 'File', 'main', 'int'].includes(c.label)), 'group completion lists only its members');
+r = complete('include std; fn main() { std.Io.| }');
+for (const name of ['print', 'println', 'put_n', 'put_f', 'getline']) get(r.items, name);
+assert.ok(!r.items.some(c => ['write', 'itoa', 'main', 'int'].includes(c.label)), 'std.Io. lists only Io members');
+r = complete('include std; fn main() { std.Io.pr| }');
+assert.deepStrictEqual(r.items.map(c => c.label).sort(), ['print', 'println']);
+console.log('ok completion: signatures, docs, fuzzy ranking, scope, array members, shadowing, consumed lifetimes and one level of a module path');