diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/drivers/completion_test.js | 13 |
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'); |
