Skip to content

Commit 5be505e

Browse files
committed
test: minimal repl eval option test
Fixes: nodejs#3544
1 parent 2848f84 commit 5be505e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/parallel/test-repl-eval.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const repl = require('repl');
5+
6+
{
7+
const options = {
8+
eval: common.mustCall((cmd, context) => {
9+
assert.strictEqual(cmd, 'foo\n');
10+
assert.deepStrictEqual(context, {animal: 'Sterrance'});
11+
})
12+
};
13+
14+
const r = repl.start(options);
15+
r.context = {animal: 'Sterrance'};
16+
17+
try {
18+
r.write('foo\n');
19+
} finally {
20+
r.write('.exit\n');
21+
}
22+
}

0 commit comments

Comments
 (0)