mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
PR-URL: https://github.com/nodejs/node/pull/59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
36 lines
875 B
JavaScript
36 lines
875 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { startNewREPLServer } = require('../common/repl');
|
|
|
|
// Tab completion in editor mode
|
|
{
|
|
const { replServer, input } = startNewREPLServer();
|
|
|
|
input.run(['.clear', '.editor']);
|
|
|
|
replServer.completer('Uin', common.mustCall((_error, data) => {
|
|
assert.deepStrictEqual(data, [['Uint'], 'Uin']);
|
|
}));
|
|
|
|
input.run(['.clear', '.editor']);
|
|
|
|
replServer.completer('var log = console.l', common.mustCall((_error, data) => {
|
|
assert.deepStrictEqual(data, [['console.log'], 'console.l']);
|
|
}));
|
|
}
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/43528
|
|
{
|
|
const { replServer } = startNewREPLServer();
|
|
|
|
// Editor mode
|
|
replServer.write('.editor\n');
|
|
|
|
replServer.write('a');
|
|
replServer.write(null, { name: 'tab' }); // Should not throw
|
|
|
|
replServer.close();
|
|
}
|