Skip to content

Commit

Permalink
test: improve coverage for question in readline
Browse files Browse the repository at this point in the history
PR-URL: #38799
Refs: https://coverage.nodejs.org/coverage-dc43066ee9a37655/lib/readline.js.html#L443
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Ayase-252 authored and richardlau committed Jul 20, 2021
1 parent 86477b2 commit 504bfd7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-readline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,18 @@ for (let i = 0; i < 12; i++) {
rli.close();
}

// Calling the question multiple times
{
const [rli] = getInterface({ terminal });
rli.question('foo?', common.mustCall((answer) => {
assert.strictEqual(answer, 'baz');
}));
rli.question('bar?', common.mustNotCall(() => {
}));
rli.write('baz\n');
rli.close();
}

// Can create a new readline Interface with a null output argument
{
const [rli, fi] = getInterface({ output: null, terminal });
Expand Down

0 comments on commit 504bfd7

Please sign in to comment.