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>
This commit is contained in:
parent
010ac70892
commit
bbf3838c70
@ -327,6 +327,11 @@ function isWarned(emitter) {
|
||||
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.
|
||||
assert.equal(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false);
|
||||
assert.equal(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user