summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorZijian Liu <Lxxyxzj@gmail.com>2020-12-05 02:32:46 +0800
committerDaniel Bevenius <daniel.bevenius@gmail.com>2020-12-07 05:58:56 +0100
commitd2e4b98de27c0eb02493df1fab533489ba2502cf (patch)
treea4becd1b99155360a8dfc2091761c0bbaf51552a /test
parent5fa7c2ab940789065383fb9aa879a9f12506eb67 (diff)
downloadios-node-v8-d2e4b98de27c0eb02493df1fab533489ba2502cf.tar.gz
ios-node-v8-d2e4b98de27c0eb02493df1fab533489ba2502cf.tar.bz2
ios-node-v8-d2e4b98de27c0eb02493df1fab533489ba2502cf.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-readline-interface.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js
index 3a14d618ad..8e32edcc49 100644
--- a/test/parallel/test-readline-interface.js
+++ b/test/parallel/test-readline-interface.js
@@ -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: '' });