target-set-user-error.js (840B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 19.1.2.1 5 description: Errors thrown during definition of target object attributes 6 info: | 7 [...] 8 5. For each element nextSource of sources, in ascending index order, 9 [...] 10 c. Repeat for each element nextKey of keys in List order, 11 [...] 12 iii. if desc is not undefined and desc.[[Enumerable]] is true, then 13 [...] 14 3. Let status be Set(to, nextKey, propValue, true). 15 4. ReturnIfAbrupt(status). 16 ---*/ 17 18 var target = {}; 19 Object.defineProperty(target, 'attr', { 20 set: function(_) { 21 throw new Test262Error(); 22 } 23 }); 24 25 assert.throws(Test262Error, function() { 26 Object.assign(target, { 27 attr: 1 28 }); 29 }); 30 31 reportCompare(0, 0);