From e3097b7cdf1096db65eaf2607bf6e0c04a60f202 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 25 Jun 2016 15:18:04 -0700 Subject: [PATCH] test: test isFullWidthCodePoint with invalid input Code coverage information shows that we are only testing the happy path for the internal readline `isFullWidthCodePoint()` function. Test it with invalid input. PR-URL: https://github.com/nodejs/node/pull/7422 Reviewed-By: Anna Henningsen Reviewed-By: Brian White Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- test/parallel/test-readline-interface.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 4997b6e9bdb60b..8c7a4d12d100ce 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -304,6 +304,11 @@ function isWarned(emitter) { rli.close(); } + // isFullWidthCodePoint() should return false for non-numeric values + [true, false, null, undefined, {}, [], 'あ'].forEach((v) => { + assert.strictEqual(readline.isFullWidthCodePoint('あ'), false); + }); + // wide characters should be treated as two columns. assert.equal(readline.isFullWidthCodePoint('a'.charCodeAt(0)), false); assert.equal(readline.isFullWidthCodePoint('あ'.charCodeAt(0)), true);