From 731c55a08e6f91ac44d860243ce52ebbc380cb62 Mon Sep 17 00:00:00 2001 From: Masashi Hirano Date: Sat, 19 May 2018 13:11:01 +0900 Subject: [PATCH] test: improve coverage for internal/readline Add tests for readline keys to improve coverage. PR-URL: https://github.com/nodejs/node/pull/20840 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Benjamin Gruenbaum --- test/parallel/test-readline-keys.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 62d5ab24b85cef..f739999110b12f 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -279,6 +279,23 @@ addTest('\x1b[31ma\x1b[39ma', [ { name: 'a', sequence: 'a' }, ]); +// rxvt keys with modifiers +addTest('\x1b[a\x1b[b\x1b[c\x1b[d\x1b[e', [ + { name: 'up', sequence: '\x1b[a', code: '[a', shift: true }, + { name: 'down', sequence: '\x1b[b', code: '[b', shift: true }, + { name: 'right', sequence: '\x1b[c', code: '[c', shift: true }, + { name: 'left', sequence: '\x1b[d', code: '[d', shift: true }, + { name: 'clear', sequence: '\x1b[e', code: '[e', shift: true }, +]); + +addTest('\x1bOa\x1bOb\x1bOc\x1bOd\x1bOe', [ + { name: 'up', sequence: '\x1bOa', code: 'Oa', ctrl: true }, + { name: 'down', sequence: '\x1bOb', code: 'Ob', ctrl: true }, + { name: 'right', sequence: '\x1bOc', code: 'Oc', ctrl: true }, + { name: 'left', sequence: '\x1bOd', code: 'Od', ctrl: true }, + { name: 'clear', sequence: '\x1bOe', code: 'Oe', ctrl: true }, +]); + // Reduce array of addKeyIntervalTest(..) right to left // with () => {} as initial function const runKeyIntervalTests = [