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>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
e3097b7cdf
  1. 5
      test/parallel/test-readline-interface.js

5
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);

Loading…
Cancel
Save