summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Map/groupBy/groupLength.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Map/groupBy/groupLength.js')
-rw-r--r--js/src/tests/test262/built-ins/Map/groupBy/groupLength.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/groupBy/groupLength.js b/js/src/tests/test262/built-ins/Map/groupBy/groupLength.js
new file mode 100644
index 0000000000..6238293a49
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Map/groupBy/groupLength.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2023 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-map.groupby
+description: Map.groupBy populates Map with correct keys and values
+info: |
+ Map.groupBy ( items, callbackfn )
+
+ ...
+includes: [compareArray.js]
+features: [array-grouping, Map, Symbol.iterator]
+---*/
+
+const arr = ['hello', 'test', 'world'];
+
+const map = Map.groupBy(arr, function (i) { return i.length; });
+
+assert.compareArray(Array.from(map.keys()), [5, 4]);
+assert.compareArray(map.get(5), ['hello', 'world']);
+assert.compareArray(map.get(4), ['test']);
+
+reportCompare(0, 0);