-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test that fails without the changes of #46742
- Loading branch information
1 parent
2b0871d
commit 3cc2379
Showing
2 changed files
with
31 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const ArrayStream = require('../common/arraystream'); | ||
const assert = require('assert'); | ||
|
||
common.skipIfDumbTerminal(); | ||
|
||
const readline = require('readline'); | ||
const rli = new readline.Interface({ | ||
terminal: true, | ||
input: new ArrayStream(), | ||
}); | ||
|
||
let recursionDepth = 0; | ||
|
||
rli.on('line', function onLine() { | ||
// Abort in case of infinite loop | ||
if (recursionDepth > 2) { | ||
return | ||
} | ||
recursionDepth++ | ||
// Write something recursively to readline | ||
rli.write('foo'); | ||
return; | ||
}); | ||
|
||
// minimal reproduction for #46731 | ||
const testInput = ' \n}\n'; | ||
rli.write(testInput); | ||
|
||
assert.strictEqual(recursionDepth, testInput.match(/\n/g).length, "infinite loop"); |
This file was deleted.
Oops, something went wrong.