diff options
author | James M Snell <jasnell@gmail.com> | 2016-08-26 11:19:43 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-08-29 15:24:03 -0700 |
commit | 4537cf2377c9db383e9f8236a5e93c3b1b1fd008 (patch) | |
tree | 1fbfa24a93d9dbace304e9b493b587f8e1132659 /test/parallel/test-buffer-compare-offset.js | |
parent | f10e1ed45511231817b44050d8c410ac5a2253be (diff) | |
download | android-node-v8-4537cf2377c9db383e9f8236a5e93c3b1b1fd008.tar.gz android-node-v8-4537cf2377c9db383e9f8236a5e93c3b1b1fd008.tar.bz2 android-node-v8-4537cf2377c9db383e9f8236a5e93c3b1b1fd008.zip |
test: additional refactoring/cleanup of buffer tests
* Favor use of strictEqual where possible
* Use const as appropriate
* Other miscellaneous cleanups
PR-URL: https://github.com/nodejs/node/pull/8283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-compare-offset.js')
-rw-r--r-- | test/parallel/test-buffer-compare-offset.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/parallel/test-buffer-compare-offset.js b/test/parallel/test-buffer-compare-offset.js index 540d644c28..2185517e06 100644 --- a/test/parallel/test-buffer-compare-offset.js +++ b/test/parallel/test-buffer-compare-offset.js @@ -6,51 +6,51 @@ const assert = require('assert'); const a = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]); const b = Buffer.from([5, 6, 7, 8, 9, 0, 1, 2, 3, 4]); -assert.equal(-1, a.compare(b)); +assert.strictEqual(-1, a.compare(b)); // Equivalent to a.compare(b). -assert.equal(-1, a.compare(b, 0)); -assert.equal(-1, a.compare(b, '0')); +assert.strictEqual(-1, a.compare(b, 0)); +assert.strictEqual(-1, a.compare(b, '0')); // Equivalent to a.compare(b). -assert.equal(-1, a.compare(b, 0, undefined, 0)); +assert.strictEqual(-1, a.compare(b, 0, undefined, 0)); // Zero-length targer, return 1 -assert.equal(1, a.compare(b, 0, 0, 0)); -assert.equal(1, a.compare(b, '0', '0', '0')); +assert.strictEqual(1, a.compare(b, 0, 0, 0)); +assert.strictEqual(1, a.compare(b, '0', '0', '0')); // Equivalent to Buffer.compare(a, b.slice(6, 10)) -assert.equal(1, a.compare(b, 6, 10)); +assert.strictEqual(1, a.compare(b, 6, 10)); // Zero-length source, return -1 -assert.equal(-1, a.compare(b, 6, 10, 0, 0)); +assert.strictEqual(-1, a.compare(b, 6, 10, 0, 0)); // Equivalent to Buffer.compare(a.slice(4), b.slice(0, 5)) -assert.equal(1, a.compare(b, 0, 5, 4)); +assert.strictEqual(1, a.compare(b, 0, 5, 4)); // Equivalent to Buffer.compare(a.slice(1), b.slice(5)) -assert.equal(1, a.compare(b, 5, undefined, 1)); +assert.strictEqual(1, a.compare(b, 5, undefined, 1)); // Equivalent to Buffer.compare(a.slice(2), b.slice(2, 4)) -assert.equal(-1, a.compare(b, 2, 4, 2)); +assert.strictEqual(-1, a.compare(b, 2, 4, 2)); // Equivalent to Buffer.compare(a.slice(4), b.slice(0, 7)) -assert.equal(-1, a.compare(b, 0, 7, 4)); +assert.strictEqual(-1, a.compare(b, 0, 7, 4)); // Equivalent to Buffer.compare(a.slice(4, 6), b.slice(0, 7)); -assert.equal(-1, a.compare(b, 0, 7, 4, 6)); +assert.strictEqual(-1, a.compare(b, 0, 7, 4, 6)); // zero length target -assert.equal(1, a.compare(b, 0, null)); +assert.strictEqual(1, a.compare(b, 0, null)); // coerces to targetEnd == 5 -assert.equal(-1, a.compare(b, 0, {valueOf: () => 5})); +assert.strictEqual(-1, a.compare(b, 0, {valueOf: () => 5})); // zero length target -assert.equal(1, a.compare(b, Infinity, -Infinity)); +assert.strictEqual(1, a.compare(b, Infinity, -Infinity)); // zero length target because default for targetEnd <= targetSource -assert.equal(1, a.compare(b, '0xff')); +assert.strictEqual(1, a.compare(b, '0xff')); const oor = /out of range index/; |