mirror of
https://github.com/nodejs/node.git
synced 2025-05-17 16:40:19 +00:00

Export a new common.noop no-operation function for general use. Allow using common.mustCall() without a fn argument to simplify test cases. Replace various non-op functions throughout tests with common.noop PR-URL: https://github.com/nodejs/node/pull/12027 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
28 lines
783 B
JavaScript
28 lines
783 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const repl = require('repl');
|
|
|
|
common.ArrayStream.prototype.write = common.noop;
|
|
|
|
const putIn = new common.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.']);
|
|
}));
|