Skip to content

Commit f1eb84e

Browse files
committed
Add known issue test
1 parent db8d809 commit f1eb84e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Reference: https://github.com/nodejs/node/pull/7624
2+
'use strict';
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const repl = require('repl');
6+
const stream = require('stream');
7+
8+
common.globalCheck = false;
9+
10+
const r = initRepl();
11+
12+
r.input.emit('data', 'function a() { return 42; } (1)\n');
13+
r.input.emit('data', 'a\n');
14+
r.input.emit('data', '.exit');
15+
16+
const expected = '1\n[Function a]\n';
17+
const got = r.output.accumulator.join('');
18+
assert.equal(got, expected);
19+
20+
function initRepl() {
21+
const input = new stream();
22+
input.write = input.pause = input.resume = () => {};
23+
input.readable = true;
24+
25+
const output = new stream();
26+
output.writable = true;
27+
output.accumulator = [];
28+
29+
output.write = (data) => output.accumulator.push(data);
30+
31+
return repl.start({
32+
input,
33+
output,
34+
useColors: false,
35+
terminal: false,
36+
prompt: ''
37+
});
38+
}
39+
40+

0 commit comments

Comments
 (0)