Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
Trott committed Jun 28, 2016
commit ae0ef11b1988ebeeaa1a0fed9c10610273d37268
3 changes: 3 additions & 0 deletions test/parallel/test-readline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ function isWarned(emitter) {
rli.close();
}

// isFullWidthCodePoint() should return false for non-numeric values
assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'), false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can extend this to [true, false, null, undefined, {}, [], 'あ'].forEach((v) => {?


// 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