mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 06:19:07 +00:00

In a continuing effort to de-monolithize `require('../common')`, move `common.ArrayStream` out to a separate module that is imported only when it is needed. PR-URL: https://github.com/nodejs/node/pull/22447 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
29 lines
820 B
JavaScript
29 lines
820 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const ArrayStream = require('../common/arraystream');
|
|
const assert = require('assert');
|
|
const repl = require('repl');
|
|
|
|
ArrayStream.prototype.write = () => {};
|
|
|
|
const putIn = new ArrayStream();
|
|
const testMe = repl.start('', putIn);
|
|
|
|
// https://github.com/nodejs/node/issues/3346
|
|
// Tab-completion should be empty
|
|
putIn.run(['.clear']);
|
|
putIn.run(['function () {']);
|
|
testMe.complete('arguments.', common.mustCall((err, completions) => {
|
|
assert.strictEqual(err, null);
|
|
assert.deepStrictEqual(completions, [[], 'arguments.']);
|
|
}));
|
|
|
|
putIn.run(['.clear']);
|
|
putIn.run(['function () {']);
|
|
putIn.run(['undef;']);
|
|
testMe.complete('undef.', common.mustCall((err, completions) => {
|
|
assert.strictEqual(err, null);
|
|
assert.deepStrictEqual(completions, [[], 'undef.']);
|
|
}));
|