Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorQingyu Deng <bitdqy@hotmail.com>2021-05-24 18:45:44 +0300
committerZiJian Liu <Lxxyxzj@gmail.com>2021-05-26 05:45:12 +0300
commitccde7fc2a6287c57d7402fd08aebcfbe3678f786 (patch)
tree017c1cf92f0f8d657e1734f30124ecb1ceba965a /test
parent2a1dea8a22b18ad1c4af6ec4ff87baf76f1d2576 (diff)
test: improve coverage for `question` in readline
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-readline-interface.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js
index 5e05610aeae..f253a443c05 100644
--- a/test/parallel/test-readline-interface.js
+++ b/test/parallel/test-readline-interface.js
@@ -905,6 +905,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();
+ }
+
// Calling the promisified question
{
const [rli] = getInterface({ terminal });