Browse Source

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 <anna@addaleax.net>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Rich Trott 8 years ago
parent
commit
bbf3838c70
  1. 5
      test/parallel/test-readline-interface.js

5
test/parallel/test-readline-interface.js

@ -327,6 +327,11 @@ function isWarned(emitter) {
rli.close(); rli.close();
} }
// isFullWidthCodePoint() should return false for non-numeric values
[true, false, null, undefined, {}, [], 'あ'].forEach((v) => {
assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'), false);
});
// wide characters should be treated as two columns. // wide characters should be treated as two columns.
assert.equal(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false); assert.equal(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false);
assert.equal(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), true); assert.equal(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), true);

Loading…
Cancel
Save