From 18016d3b3fd27fd2744a17a54f15631af6206df1 Mon Sep 17 00:00:00 2001 From: brad-decker Date: Tue, 29 Nov 2016 12:33:28 -0600 Subject: [PATCH] test: replace assert.equal with assert.strictEqual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/9842 Reviewed-By: Rich Trott Reviewed-By: Gibson Fahnestock Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso --- test/addons/async-hello-world/test.js | 4 ++-- test/addons/hello-world-function-export/test.js | 2 +- test/addons/hello-world/test.js | 2 +- test/addons/load-long-path/test.js | 2 +- .../test-stringbytes-external-at-max.js | 2 +- .../test-stringbytes-external-exceed-max-by-1-binary.js | 4 ++-- .../test-stringbytes-external-exceed-max-by-2.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/addons/async-hello-world/test.js b/test/addons/async-hello-world/test.js index bbc81bfbf8c9cb..7c27382c1c60f4 100644 --- a/test/addons/async-hello-world/test.js +++ b/test/addons/async-hello-world/test.js @@ -4,7 +4,7 @@ var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); binding(5, common.mustCall(function(err, val) { - assert.equal(null, err); - assert.equal(10, val); + assert.strictEqual(err, null); + assert.strictEqual(val, 10); process.nextTick(common.mustCall(function() {})); })); diff --git a/test/addons/hello-world-function-export/test.js b/test/addons/hello-world-function-export/test.js index 89127fc787c94e..74ea66c79c548c 100644 --- a/test/addons/hello-world-function-export/test.js +++ b/test/addons/hello-world-function-export/test.js @@ -2,5 +2,5 @@ const common = require('../../common'); var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); -assert.equal('world', binding()); +assert.strictEqual(binding(), 'world'); console.log('binding.hello() =', binding()); diff --git a/test/addons/hello-world/test.js b/test/addons/hello-world/test.js index 8d5c1238770064..32066388efe6cb 100644 --- a/test/addons/hello-world/test.js +++ b/test/addons/hello-world/test.js @@ -2,5 +2,5 @@ const common = require('../../common'); var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); -assert.equal('world', binding.hello()); +assert.strictEqual(binding.hello(), 'world'); console.log('binding.hello() =', binding.hello()); diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 2f09f2b3ff005c..b17942b45a6f34 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -34,4 +34,4 @@ fs.writeFileSync(addonDestinationPath, contents); // Attempt to load at long path destination var addon = require(addonDestinationPath); assert.notEqual(addon, null); -assert.equal(addon.hello(), 'world'); +assert.strictEqual(addon.hello(), 'world'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index bd71f05d61bf2c..2ce695852e25ae 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js @@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) { } const maxString = buf.toString('latin1'); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js index c54706fd46c599..51324a3f337731 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js @@ -34,9 +34,9 @@ assert.throws(function() { }, /"toString\(\)" failed/); var maxString = buf.toString('latin1', 1); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); // Free the memory early instead of at the end of the next assignment maxString = undefined; maxString = buf.toString('latin1', 0, kStringMaxLength); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js index 11f23ff1bf7627..0fab606e4663ec 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js @@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) { } const maxString = buf.toString('utf16le'); -assert.equal(maxString.length, (kStringMaxLength + 2) / 2); +assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2);