Skip to content

Commit bbf3838

Browse files
committed
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: nodejs#7422 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 010ac70 commit bbf3838

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-readline-interface.js

+5
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ function isWarned(emitter) {
327327
rli.close();
328328
}
329329

330+
// isFullWidthCodePoint() should return false for non-numeric values
331+
[true, false, null, undefined, {}, [], 'あ'].forEach((v) => {
332+
assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'), false);
333+
});
334+
330335
// wide characters should be treated as two columns.
331336
assert.equal(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false);
332337
assert.equal(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), true);

0 commit comments

Comments
 (0)