Skip to content

Commit 504bfd7

Browse files
Ayase-252richardlau
authored andcommitted
test: improve coverage for question in readline
PR-URL: #38799 Refs: https://coverage.nodejs.org/coverage-dc43066ee9a37655/lib/readline.js.html#L443 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 86477b2 commit 504bfd7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-readline-interface.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,18 @@ for (let i = 0; i < 12; i++) {
895895
rli.close();
896896
}
897897

898+
// Calling the question multiple times
899+
{
900+
const [rli] = getInterface({ terminal });
901+
rli.question('foo?', common.mustCall((answer) => {
902+
assert.strictEqual(answer, 'baz');
903+
}));
904+
rli.question('bar?', common.mustNotCall(() => {
905+
}));
906+
rli.write('baz\n');
907+
rli.close();
908+
}
909+
898910
// Can create a new readline Interface with a null output argument
899911
{
900912
const [rli, fi] = getInterface({ output: null, terminal });

0 commit comments

Comments
 (0)