Test non-property key throws

This commit is contained in:
Justin Ridgewell 2022-09-13 21:42:03 -04:00 committed by Philip Chimento
parent 457185507e
commit 95f869ce0d
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
// Copyright (c) 2021 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.group
description: Array.prototype.group errors when return value cannot be converted to a property key.
info: |
22.1.3.14 Array.prototype.group ( callbackfn [ , thisArg ] )
...
6. Repeat, while k < len
c. Let propertyKey be ? ToPropertyKey(? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »)).
...
features: [array-grouping]
---*/
assert.throws(Test262Error, function() {
const array = [1];
array.group(function() {
return {
toString() {
throw new Test262Error('not a property key');
}
};
})
});