Skip to content

Commit

Permalink
test: test isFullWidthCodePoint with invalid input
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
Trott committed Jun 29, 2016
1 parent 010ac70 commit bbf3838
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-readline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bbf3838

Please sign in to comment.