diff options
author | Mithun Sasidharan <mithunsasidharan89@gmail.com> | 2017-12-06 13:40:46 +0530 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-08 16:23:32 -0500 |
commit | 146a9b1a8a38285b0613559aa96498bc7859fc75 (patch) | |
tree | 9f055a5feeb75e57cdce42e53f8459d76dfb98ba /test/parallel/test-buffer-fill.js | |
parent | d8c896cac5b3e31cbffb3da2c657dd59c83fbfeb (diff) | |
download | android-node-v8-146a9b1a8a38285b0613559aa96498bc7859fc75.tar.gz android-node-v8-146a9b1a8a38285b0613559aa96498bc7859fc75.tar.bz2 android-node-v8-146a9b1a8a38285b0613559aa96498bc7859fc75.zip |
test: replace assert.throws w/ common.expectsError
PR-URL: https://github.com/nodejs/node/pull/17483
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-fill.js')
-rw-r--r-- | test/parallel/test-buffer-fill.js | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index ad724f0b2b..d33af46f72 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -306,12 +306,12 @@ function testBufs(string, offset, length, encoding) { } // Make sure these throw. -assert.throws( +common.expectsError( () => Buffer.allocUnsafe(8).fill('a', -1), - common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); -assert.throws( + { code: 'ERR_INDEX_OUT_OF_RANGE' }); +common.expectsError( () => Buffer.allocUnsafe(8).fill('a', 0, 9), - common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); + { code: 'ERR_INDEX_OUT_OF_RANGE' }); // Make sure this doesn't hang indefinitely. Buffer.allocUnsafe(8).fill(''); @@ -360,7 +360,7 @@ Buffer.alloc(8, ''); // magically mangled using Symbol.toPrimitive. { let elseWasLast = false; - assert.throws(() => { + common.expectsError(() => { let ctr = 0; const start = { [Symbol.toPrimitive]() { @@ -377,8 +377,9 @@ Buffer.alloc(8, ''); } }; Buffer.alloc(1).fill(Buffer.alloc(1), start, 1); - }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); + }, { + code: undefined, type: RangeError, message: 'Index out of range' + }); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); @@ -386,16 +387,17 @@ Buffer.alloc(8, ''); // Testing process.binding. Make sure "start" is properly checked for -1 wrap // around. -assert.throws(() => { +common.expectsError(() => { process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1); -}, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); +}, { + code: undefined, type: RangeError, message: 'Index out of range' +}); // Make sure "end" is properly checked, even if it's magically mangled using // Symbol.toPrimitive. { let elseWasLast = false; - assert.throws(() => { + common.expectsError(() => { let ctr = 0; const end = { [Symbol.toPrimitive]() { @@ -412,8 +414,9 @@ assert.throws(() => { } }; Buffer.alloc(1).fill(Buffer.alloc(1), 0, end); - }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range' })); + }, { + code: undefined, type: RangeError, message: 'Index out of range' + }); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); |