From b8a8eedf3280f3825812d3f8f0554a186396c9dc Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 25 Sep 2018 11:17:30 +0200 Subject: [PATCH] assert: switch `inputs` to `values` The wording seems clearer when using `values` instead of `inputs`. PR-URL: https://github.com/nodejs/node/pull/23056 Refs: https://github.com/nodejs/node/issues/22763 Reviewed-By: Matteo Collina Reviewed-By: Ujjwal Sharma Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca --- lib/internal/assert.js | 12 ++++++------ test/message/assert_throws_stack.out | 2 +- test/message/error_exit.out | 2 +- test/parallel/test-assert-checktag.js | 4 ++-- test/parallel/test-assert-deep.js | 4 ++-- test/parallel/test-assert.js | 8 ++++---- test/pseudo-tty/test-assert-colors.js | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/internal/assert.js b/lib/internal/assert.js index b6c1253ba99751..92c2a1d0af893e 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -11,18 +11,18 @@ let red = ''; let white = ''; const kReadableOperator = { - deepStrictEqual: 'Expected inputs to be strictly deep-equal:', - strictEqual: 'Expected inputs to be strictly equal:', + deepStrictEqual: 'Expected values to be strictly deep-equal:', + strictEqual: 'Expected values to be strictly equal:', strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', - deepEqual: 'Expected inputs to be loosely deep-equal:', - equal: 'Expected inputs to be loosely equal:', + deepEqual: 'Expected values to be loosely deep-equal:', + equal: 'Expected values to be loosely equal:', notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', notStrictEqual: 'Expected "actual" to be strictly unequal to:', // eslint-disable-next-line max-len notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', notEqual: 'Expected "actual" to be loosely unequal to:', - notIdentical: 'Inputs identical but not reference equal:', + notIdentical: 'Values identical but not reference-equal:', }; // Comparing short primitives should just show === / !== instead of using the @@ -74,7 +74,7 @@ function createErrDiff(actual, expected, operator) { let i = 0; let indicator = ''; - // In case both inputs are objects explicitly mark them as not reference equal + // In case both values are objects explicitly mark them as not reference equal // for the `strictEqual` operator. if (operator === 'strictEqual' && typeof actual === 'object' && diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out index 3013dbc0286bb2..cf96ee42c98cb7 100644 --- a/test/message/assert_throws_stack.out +++ b/test/message/assert_throws_stack.out @@ -2,7 +2,7 @@ assert.js:* throw err; ^ -AssertionError [ERR_ASSERTION]: Expected inputs to be strictly deep-equal: +AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected + Comparison {} diff --git a/test/message/error_exit.out b/test/message/error_exit.out index cc1edf46cb0001..be46bbc1ae9b5a 100644 --- a/test/message/error_exit.out +++ b/test/message/error_exit.out @@ -3,7 +3,7 @@ assert.js:* throw new AssertionError(obj); ^ -AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: +AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 1 !== 2 diff --git a/test/parallel/test-assert-checktag.js b/test/parallel/test-assert-checktag.js index 754e5649145f17..eeb25278ff186f 100644 --- a/test/parallel/test-assert-checktag.js +++ b/test/parallel/test-assert-checktag.js @@ -26,14 +26,14 @@ if (process.stdout.isTTY) assert.throws( () => assert.deepStrictEqual(date, fake), { - message: 'Expected inputs to be strictly deep-equal:\n' + + message: 'Expected values to be strictly deep-equal:\n' + '+ actual - expected\n\n+ 2016-01-01T00:00:00.000Z\n- Date {}' } ); assert.throws( () => assert.deepStrictEqual(fake, date), { - message: 'Expected inputs to be strictly deep-equal:\n' + + message: 'Expected values to be strictly deep-equal:\n' + '+ actual - expected\n\n+ Date {}\n- 2016-01-01T00:00:00.000Z' } ); diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index fab681a89f6a03..306e8367d45502 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -4,7 +4,7 @@ require('../common'); const assert = require('assert'); const util = require('util'); const { AssertionError } = assert; -const defaultMsgStart = 'Expected inputs to be strictly deep-equal:\n'; +const defaultMsgStart = 'Expected values to be strictly deep-equal:\n'; const defaultMsgStartFull = `${defaultMsgStart}+ actual - expected`; // Disable colored output to prevent color codes from breaking assertion @@ -16,7 +16,7 @@ if (process.stdout.isTTY) // Template tag function turning an error message into a RegExp // for assert.throws() function re(literals, ...values) { - let result = 'Expected inputs to be loosely deep-equal:\n\n'; + let result = 'Expected values to be loosely deep-equal:\n\n'; for (const [i, value] of values.entries()) { const str = util.inspect(value, { compact: false, diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 883ebea1a2df76..8e6c2e52b5be55 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -34,8 +34,8 @@ const a = assert; if (process.stdout.isTTY) process.env.NODE_DISABLE_COLORS = '1'; -const strictEqualMessageStart = 'Expected inputs to be strictly equal:\n'; -const start = 'Expected inputs to be strictly deep-equal:'; +const strictEqualMessageStart = 'Expected values to be strictly equal:\n'; +const start = 'Expected values to be strictly deep-equal:'; const actExp = '+ actual - expected'; assert.ok(a.AssertionError.prototype instanceof Error, @@ -1013,7 +1013,7 @@ assert.throws(() => { throw null; }, 'foo'); assert.throws( () => assert.strictEqual([], []), { - message: 'Inputs identical but not reference equal:\n\n[]\n' + message: 'Values identical but not reference-equal:\n\n[]\n' } ); @@ -1107,7 +1107,7 @@ assert.throws( } ); -// Check for reference equal objects in `notStrictEqual()` +// Check for reference-equal objects in `notStrictEqual()` assert.throws( () => { const obj = {}; diff --git a/test/pseudo-tty/test-assert-colors.js b/test/pseudo-tty/test-assert-colors.js index cd855dc06eac27..e843bcb218a078 100644 --- a/test/pseudo-tty/test-assert-colors.js +++ b/test/pseudo-tty/test-assert-colors.js @@ -7,7 +7,7 @@ try { process.env.COLORTERM = '1'; assert.deepStrictEqual([1, 2, 2, 2], [2, 2, 2, 2]); } catch (err) { - const expected = 'Expected inputs to be strictly deep-equal:\n' + + const expected = 'Expected values to be strictly deep-equal:\n' + '\u001b[32m+ actual\u001b[39m \u001b[31m- expected\u001b[39m' + ' \u001b[34m...\u001b[39m Lines skipped\n\n' + ' [\n' +