Skip to content

Commit 365f520

Browse files
TrottFishrock123
authored andcommitted
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: #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 58ae35c commit 365f520

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ function isWarned(emitter){
325325
rli.close();
326326
}
327327

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

0 commit comments

Comments
(0)