Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2270ab2

Browse filesBrowse 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 <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 187951c commit 2270ab2
Copy full SHA for 2270ab2

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-intl.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-intl.js
+10-10Lines changed: 10 additions & 10 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.