Skip to content

Commit

Permalink
test: check option start or end is not safe integer
Browse files Browse the repository at this point in the history
To increase fs readstream coverage, added test to check error when
option.start or end is not safe integer.

PR-URL: #21704
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Masashi Hirano authored and addaleax committed Jul 10, 2018
1 parent 3898abc commit 1f16758
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/parallel/test-fs-read-stream-throw-type-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ fs.createReadStream(example, { start: 1, end: 5 });

// Case 6: Should throw RangeError if start is greater than end
createReadStreamErr(example, { start: 5, end: 1 }, rangeError);

// Case 7: Should throw RangeError if start or end is not safe integer
const NOT_SAFE_INTEGER = 2 ** 53;
[
{ start: NOT_SAFE_INTEGER, end: Infinity },
{ start: 0, end: NOT_SAFE_INTEGER }
].forEach((opts) =>
createReadStreamErr(example, opts, rangeError)
);

0 comments on commit 1f16758

Please sign in to comment.