test: repl tab completion test
It checks that `eval` is called with `.scope` as an input string. PR-URL: https://github.com/nodejs/node/pull/5534 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
e136c179c1
commit
c7b127025a
23
test/parallel/test-repl-eval-scope.js
Normal file
23
test/parallel/test-repl-eval-scope.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
'use strict';
|
||||||
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
const repl = require('repl');
|
||||||
|
|
||||||
|
{
|
||||||
|
const stream = new common.ArrayStream();
|
||||||
|
const options = {
|
||||||
|
eval: common.mustCall((cmd, context) => {
|
||||||
|
assert.strictEqual(cmd, '.scope\n');
|
||||||
|
assert.deepStrictEqual(context, {animal: 'Sterrance'});
|
||||||
|
}),
|
||||||
|
input: stream,
|
||||||
|
output: stream,
|
||||||
|
terminal: true
|
||||||
|
};
|
||||||
|
|
||||||
|
const r = repl.start(options);
|
||||||
|
r.context = {animal: 'Sterrance'};
|
||||||
|
|
||||||
|
stream.emit('data', '\t');
|
||||||
|
stream.emit('.exit\n');
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user