Skip to content

Commit e3097b7

Browse files
TrottMyles Borins
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 f0b0fc4 commit e3097b7

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
@@ -304,6 +304,11 @@ function isWarned(emitter){
304304
rli.close();
305305
}
306306

307+
// isFullWidthCodePoint() should return false for non-numeric values
308+
[true,false,null,undefined,{},[],'あ'].forEach((v)=>{
309+
assert.strictEqual(readline.isFullWidthCodePoint('あ'),false);
310+
});
311+
307312
// wide characters should be treated as two columns.
308313
assert.equal(readline.isFullWidthCodePoint('a'.charCodeAt(0)),false);
309314
assert.equal(readline.isFullWidthCodePoint('あ'.charCodeAt(0)),true);

0 commit comments

Comments
(0)