Skip to content
Merged
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
Prev Previous commit
Next Next commit
add test
  • Loading branch information
seishun committed Feb 2, 2017
commit 0635c4ac4bfcffb13a5cbf809dbf10879a269f7d
3 changes: 3 additions & 0 deletions test/parallel/test-buffer-tostring-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, true), 'a');
assert.strictEqual(rangeBuffer.toString({toString: function() {
return 'ascii';
}}), 'abc');

// try toString() with 0 as the encoding
assert.throws(() => rangeBuffer.toString(0, 1, 2), /Unknown encoding/);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you improve the regular expression to something like /^TypeError: Unknown encoding: 0$/.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a similar test for null, minimally.

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.

Better include the complete message, like ^TypeError: Unknown encoding: undefined$.