mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: increase coverage for readline
1. test call readline.Interface without new should return instance Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/readline.js.html#L101 2. test keypress ctrl + c should close readline interface Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/readline.js.html#L891 PR-URL: https://github.com/nodejs/node/pull/36389 Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/readline.js.html#L101 Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/readline.js.html#L891 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
f515156fab
commit
5fc0f5eabb
1 file changed
+13
@@ -63,6 +63,12 @@ function assertCursorRowsAndCols(rli, rows, cols) {
|
||||
assert.strictEqual(cursorPos.cols, cols);
|
||||
}
|
||||
|
||||
{
|
||||
const input = new FakeInput();
|
||||
const rl = readline.Interface({ input });
|
||||
assert(rl instanceof readline.Interface);
|
||||
}
|
||||
|
||||
[
|
||||
undefined,
|
||||
50,
|
||||
@@ -657,6 +663,13 @@ function assertCursorRowsAndCols(rli, rows, cols) {
|
||||
rli.close();
|
||||
}
|
||||
|
||||
// Close readline interface
|
||||
{
|
||||
const [rli, fi] = getInterface({ terminal: true, prompt: '' });
|
||||
fi.emit('keypress', '.', { ctrl: true, name: 'c' });
|
||||
assert(rli.closed);
|
||||
}
|
||||
|
||||
// Multi-line input cursor position
|
||||
{
|
||||
const [rli, fi] = getInterface({ terminal: true, prompt: '' });
|
||||
|
||||
Reference in new issue
Block a user