Debian Codegraph @

js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js

raw
1 'use strict';
2 // Copyright (c) 2012 Ecma International. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 es5id: 11.13.2-32-s
7 description: >
8 Strict Mode - TypeError is thrown if The LeftHandSide of a
9 Compound Assignment operator(^=) is a reference to a data property
10 with the attribute value {[[Writable]]:false}
11 flags: [onlyStrict]
12 ---*/
13
14 var obj = {};
15 Object.defineProperty(obj, "prop", {
16 value: 10,
17 writable: false,
18 enumerable: true,
19 configurable: true
20 });
21 assert.throws(TypeError, function() {
22 obj.prop ^= 20;
23 });
24 assert.sameValue(obj.prop, 10, 'obj.prop');
25
26 reportCompare(0, 0);