Skip to content

Commit b258ddd

Browse files
santigimenoMyles Borins
authored and
Myles Borins
committed
test: repl tab completion test
It checks that `eval` is called with `.scope` as an input string. PR-URL: #5534 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3b8fc4f commit b258ddd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/parallel/test-repl-eval-scope.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const repl = require('repl');
5+
6+
{
7+
const stream = new common.ArrayStream();
8+
const options = {
9+
eval: common.mustCall((cmd, context) => {
10+
assert.strictEqual(cmd, '.scope\n');
11+
assert.deepStrictEqual(context, {animal: 'Sterrance'});
12+
}),
13+
input: stream,
14+
output: stream,
15+
terminal: true
16+
};
17+
18+
const r = repl.start(options);
19+
r.context = {animal: 'Sterrance'};
20+
21+
stream.emit('data', '\t');
22+
stream.emit('.exit\n');
23+
}

0 commit comments

Comments
 (0)