Skip to content

Commit

Permalink
test: minimal repl eval option test
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Feb 11, 2016
1 parent 2848f84 commit 5be505e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/parallel/test-repl-eval.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const repl = require('repl');

{
const options = {
eval: common.mustCall((cmd, context) => {
assert.strictEqual(cmd, 'foo\n');
assert.deepStrictEqual(context, {animal: 'Sterrance'});
})
};

const r = repl.start(options);
r.context = {animal: 'Sterrance'};

try {
r.write('foo\n');
} finally {
r.write('.exit\n');
}
}

0 comments on commit 5be505e

Please sign in to comment.