consistent-writable-regexp-dollar1.js (848B)
1 // Copyright (C) 2017 Claude Pache. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-invariants-of-the-essential-internal-methods 5 description: > 6 A property made non-writable, non-configurable must not be reported as writable 7 ("$1" property of the RegExp built-in) 8 info: | 9 [[GetOwnProperty]] (P) 10 [...] 11 - If the [[Writable]] attribute may change from false to true, 12 then the [[Configurable]] attribute must be true.. 13 [...] 14 (This invariant was violated for the specific property under test by at least 15 one implementation as of January 2017.) 16 ---*/ 17 18 if (Reflect.defineProperty(RegExp, '$1', { 19 writable: false, 20 configurable: false 21 })) { 22 var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1'); 23 assert.sameValue(desc.writable, false); 24 } 25 26 reportCompare(0, 0);