Skip to content

Commit 2270ab2

Browse files
kylstrajtargos
authored andcommitted
test: remove string literals from assert.strictEqual() calls
In test/parallel/test-intl.js, five calls to assert.strictEqual() use a third, string-literal parameter, which specifies a message to display when the assertion fails. The problem is that if the assertion fails, the error message will show the string literal but not the values that caused the assertion to fail. This commit removes the third parameter from the five calls and makes them comments above the assertions instead. The default error message produced by assert.strictEqual() shows the values that caused the assertion to fail, which should be somewhat more helpful. PR-URL: #21211 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 187951c commit 2270ab2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/parallel/test-intl.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ if (!common.hasIntl) {
105105
const collOpts = { sensitivity: 'base', ignorePunctuation: true };
106106
const coll = new Intl.Collator(['en'], collOpts);
107107

108-
assert.strictEqual(coll.compare('blackbird', 'black-bird'), 0,
109-
'ignore punctuation failed');
110-
assert.strictEqual(coll.compare('blackbird', 'red-bird'), -1,
111-
'compare less failed');
112-
assert.strictEqual(coll.compare('bluebird', 'blackbird'), 1,
113-
'compare greater failed');
114-
assert.strictEqual(coll.compare('Bluebird', 'bluebird'), 0,
115-
'ignore case failed');
116-
assert.strictEqual(coll.compare('\ufb03', 'ffi'), 0,
117-
'ffi ligature (contraction) failed');
108+
// ignore punctuation
109+
assert.strictEqual(coll.compare('blackbird', 'black-bird'), 0);
110+
// compare less
111+
assert.strictEqual(coll.compare('blackbird', 'red-bird'), -1);
112+
// compare greater
113+
assert.strictEqual(coll.compare('bluebird', 'blackbird'), 1);
114+
// ignore case
115+
assert.strictEqual(coll.compare('Bluebird', 'bluebird'), 0);
116+
// ffi ligature (contraction)
117+
assert.strictEqual(coll.compare('\ufb03', 'ffi'), 0);
118118
}

0 commit comments

Comments
 (0)