Skip to content

Commit c286312

Browse files
brad-deckeraddaleax
authored andcommitted
test: replace assert.equal with assert.strictEqual
Using NodeTodo I learned of a need to swap out the .equal function with .strictEqual in a few test files. https://twitter.com/NodeTodo/status/803657321993961472 https://gist.github.com/Trott/864401455d4afa2428cd4814e072bd7c additional commits squashed: .strictEqual's argument signature is actual, expected, [message]. Previously some statements were listed as expected, actual. As asked in PR i swapped them to match the correct argument signature. PR-URL: #9842 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 0ccb2c3 commit c286312

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

test/addons/async-hello-world/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var assert = require('assert');
44
const binding = require(`./build/${common.buildType}/binding`);
55

66
binding(5, common.mustCall(function(err, val) {
7-
assert.equal(null, err);
8-
assert.equal(10, val);
7+
assert.strictEqual(err, null);
8+
assert.strictEqual(val, 10);
99
process.nextTick(common.mustCall(function() {}));
1010
}));

test/addons/hello-world-function-export/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
const common = require('../../common');
33
var assert = require('assert');
44
const binding = require(`./build/${common.buildType}/binding`);
5-
assert.equal('world', binding());
5+
assert.strictEqual(binding(), 'world');
66
console.log('binding.hello() =', binding());

test/addons/hello-world/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
const common = require('../../common');
33
var assert = require('assert');
44
const binding = require(`./build/${common.buildType}/binding`);
5-
assert.equal('world', binding.hello());
5+
assert.strictEqual(binding.hello(), 'world');
66
console.log('binding.hello() =', binding.hello());

test/addons/load-long-path/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ fs.writeFileSync(addonDestinationPath, contents);
3434
// Attempt to load at long path destination
3535
var addon = require(addonDestinationPath);
3636
assert.notEqual(addon, null);
37-
assert.equal(addon.hello(), 'world');
37+
assert.strictEqual(addon.hello(), 'world');

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) {
3030
}
3131

3232
const maxString = buf.toString('latin1');
33-
assert.equal(maxString.length, kStringMaxLength);
33+
assert.strictEqual(maxString.length, kStringMaxLength);

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ assert.throws(function() {
3434
}, /"toString\(\)" failed/);
3535

3636
var maxString = buf.toString('latin1', 1);
37-
assert.equal(maxString.length, kStringMaxLength);
37+
assert.strictEqual(maxString.length, kStringMaxLength);
3838
// Free the memory early instead of at the end of the next assignment
3939
maxString = undefined;
4040

4141
maxString = buf.toString('latin1', 0, kStringMaxLength);
42-
assert.equal(maxString.length, kStringMaxLength);
42+
assert.strictEqual(maxString.length, kStringMaxLength);

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) {
3030
}
3131

3232
const maxString = buf.toString('utf16le');
33-
assert.equal(maxString.length, (kStringMaxLength + 2) / 2);
33+
assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2);

0 commit comments

Comments
 (0)