Skip to content

Commit

Permalink
test: repl tab completion test
Browse files Browse the repository at this point in the history
It checks that `eval` is called with `.scope` as an input string.

PR-URL: #5534
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
santigimeno authored and Fishrock123 committed Mar 22, 2016
1 parent d2d0fe9 commit 70512e5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/parallel/test-repl-eval-scope.js
Original file line number Diff line number Diff line change
@@ -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');
}

0 comments on commit 70512e5

Please sign in to comment.