summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js')
-rw-r--r--js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js b/js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js
new file mode 100644
index 0000000000..d524ef734a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/groupBy/null-prototype.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2023 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.groupby
+description: Object.groupBy returns a null prototype object
+info: |
+ Object.groupBy ( items, callbackfn )
+
+ ...
+
+ 2. Let obj be OrdinaryObjectCreate(null).
+ ...
+ 4. Return obj.
+
+ ...
+features: [array-grouping]
+---*/
+
+const array = [1, 2, 3];
+
+const obj = Object.groupBy(array, function (i) {
+ return i % 2 === 0 ? 'even' : 'odd';
+});
+
+assert.sameValue(Object.getPrototypeOf(obj), null);
+assert.sameValue(obj.hasOwnProperty, undefined);
+
+reportCompare(0, 0);