Skip to content

Commit

Permalink
test: refactor and fix test-buffer-bytelength
Browse files Browse the repository at this point in the history
* assert.equal -> assert.strictEqual.
* Fix incorrect use of string instead of RegExp in `throws` assertions.

PR-URL: #9808
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Prince John Wesley <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
targos authored and addaleax committed Dec 5, 2016
1 parent e0e62d1 commit dcba250
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-buffer-bytelength.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const vm = require('vm');

// coerce values to string
assert.throws(() => { Buffer.byteLength(32, 'latin1'); },
'"string" must be a string, Buffer, or ArrayBuffer');
/"string" must be a string, Buffer, or ArrayBuffer/);
assert.throws(() => { Buffer.byteLength(NaN, 'utf8'); },
'"string" must be a string, Buffer, or ArrayBuffer');
/"string" must be a string, Buffer, or ArrayBuffer/);
assert.throws(() => { Buffer.byteLength({}, 'latin1'); },
'"string" must be a string, Buffer, or ArrayBuffer');
/"string" must be a string, Buffer, or ArrayBuffer/);
assert.throws(() => { Buffer.byteLength(); },
'"string" must be a string, Buffer, or ArrayBuffer');
/"string" must be a string, Buffer, or ArrayBuffer/);

assert(ArrayBuffer.isView(new Buffer(10)));
assert(ArrayBuffer.isView(new SlowBuffer(10)));
Expand All @@ -31,7 +31,7 @@ assert.strictEqual(Buffer.byteLength(ascii), 3);

// ArrayBuffer
var buffer = new ArrayBuffer(8);
assert.equal(Buffer.byteLength(buffer), 8);
assert.strictEqual(Buffer.byteLength(buffer), 8);

// TypedArray
var int8 = new Int8Array(8);
Expand Down

0 comments on commit dcba250

Please sign in to comment.