Skip to content

Commit 3cc2379

Browse files
committed
test: add test that fails without the changes of nodejs#46742
1 parent 2b0871d commit 3cc2379

File tree

2 files changed

+31
-47
lines changed

2 files changed

+31
-47
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
const common = require('../common');
3+
const ArrayStream = require('../common/arraystream');
4+
const assert = require('assert');
5+
6+
common.skipIfDumbTerminal();
7+
8+
const readline = require('readline');
9+
const rli = new readline.Interface({
10+
terminal: true,
11+
input: new ArrayStream(),
12+
});
13+
14+
let recursionDepth = 0;
15+
16+
rli.on('line', function onLine() {
17+
// Abort in case of infinite loop
18+
if (recursionDepth > 2) {
19+
return
20+
}
21+
recursionDepth++
22+
// Write something recursively to readline
23+
rli.write('foo');
24+
return;
25+
});
26+
27+
// minimal reproduction for #46731
28+
const testInput = ' \n}\n';
29+
rli.write(testInput);
30+
31+
assert.strictEqual(recursionDepth, testInput.match(/\n/g).length, "infinite loop");

test/parallel/test-repl-load-multiline-function.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)