mirror of
https://github.com/tc39/test262.git
synced 2025-07-01 11:14:52 +02:00
Coverage: Object.assign, Assignment to readonly property of target must throw a TypeError exception. Fixes gh-2788
This commit is contained in:
parent
fd26fc17ea
commit
b11c1607c0
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-object.assign
|
||||||
|
description: >
|
||||||
|
Assignment to readonly property of target must throw a TypeError exception
|
||||||
|
info: |
|
||||||
|
Let to be ? ToObject(target).
|
||||||
|
If only one argument was passed, return to.
|
||||||
|
For each element nextSource of sources, do
|
||||||
|
If nextSource is neither undefined nor null, then
|
||||||
|
Let from be ! ToObject(nextSource).
|
||||||
|
Let keys be ? from.[[OwnPropertyKeys]]().
|
||||||
|
For each element nextKey of keys, do
|
||||||
|
Let desc be ? from.[[GetOwnProperty]](nextKey).
|
||||||
|
If desc is not undefined and desc.[[Enumerable]] is true, then
|
||||||
|
Let propValue be ? Get(from, nextKey).
|
||||||
|
Perform ? Set(to, nextKey, propValue, true).
|
||||||
|
|
||||||
|
Set ( O, P, V, Throw ) sec-set-o-p-v-throw
|
||||||
|
|
||||||
|
Let success be ? O.[[Set]](P, V, O).
|
||||||
|
If success is false and Throw is true, throw a TypeError exception.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.throws(TypeError, () => {
|
||||||
|
Object.assign('a', [1]);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user