summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-09-21 10:40:42 +0200
committerMichaël Zasso <targos@protonmail.com>2018-09-22 14:29:37 +0200
commite758d4ab0adf53f2a4b736433714943bc4b4f06f (patch)
treeb350211f3c0999cc30733eea3419d99a18bd44ac /test
parent36bdd19a6b3aee18143a3d45d6eedc19a2e95189 (diff)
downloadandroid-node-v8-e758d4ab0adf53f2a4b736433714943bc4b4f06f.tar.gz
android-node-v8-e758d4ab0adf53f2a4b736433714943bc4b4f06f.tar.bz2
android-node-v8-e758d4ab0adf53f2a4b736433714943bc4b4f06f.zip
doc,test: fix inspect's sorted compare function
In V8 7.0, the array sorting algorithm was changed to Timsort, which is stable. A compare function returning only `true` or `false` (converted to 0 and 1) cannot work properly. PR-URL: https://github.com/nodejs/node/pull/22992 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-util-inspect.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index cd7d08caf0..1d37e97897 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -1688,7 +1688,7 @@ assert.strictEqual(
assert.strictEqual(
inspect(
{ a200: 4, a100: 1, a102: 3, a101: 2 },
- { sorted(a, b) { return a < b; } }
+ { sorted(a, b) { return b.localeCompare(a); } }
),
'{ a200: 4, a102: 3, a101: 2, a100: 1 }'
);