Skip to content

Commit 5fc0f5e

Browse files
Lxxyxtargos
authored andcommitted
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: #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 <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent f515156 commit 5fc0f5e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parallel/test-readline-interface.js

+13
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ function assertCursorRowsAndCols(rli, rows, cols) {
6363
assert.strictEqual(cursorPos.cols, cols);
6464
}
6565

66+
{
67+
const input = new FakeInput();
68+
const rl = readline.Interface({ input });
69+
assert(rl instanceof readline.Interface);
70+
}
71+
6672
[
6773
undefined,
6874
50,
@@ -657,6 +663,13 @@ function assertCursorRowsAndCols(rli, rows, cols) {
657663
rli.close();
658664
}
659665

666+
// Close readline interface
667+
{
668+
const [rli, fi] = getInterface({ terminal: true, prompt: '' });
669+
fi.emit('keypress', '.', { ctrl: true, name: 'c' });
670+
assert(rli.closed);
671+
}
672+
660673
// Multi-line input cursor position
661674
{
662675
const [rli, fi] = getInterface({ terminal: true, prompt: '' });

0 commit comments

Comments
 (0)