mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 22:45:10 +02:00
Test non-property key throws
This commit is contained in:
parent
457185507e
commit
95f869ce0d
28
test/built-ins/Array/prototype/group/invalid-property-key.js
vendored
Normal file
28
test/built-ins/Array/prototype/group/invalid-property-key.js
vendored
Normal 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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user