test262/test/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-$1.js
Claude Pache a266cfa8cb Add tests for known violation of invariants (#841)
Some popular JavaScript engines display violation of invariants about
property attributes for some non-standard but “web-reality” object
properties. Add tests against such violations

Closes #653
Fixes #649
2017-03-01 15:32:46 -05:00

23 lines
835 B
JavaScript

// Copyright (C) 2017 Claude Pache. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-invariants-of-the-essential-internal-methods
es6id: 6.1.7.3
description: >
A property made non-writable, non-configurable must not be reported as writable
("$1" property of the RegExp built-in)
info: |
[[GetOwnProperty]] (P)
[...]
- If the [[Writable]] attribute may change from false to true,
then the [[Configurable]] attribute must be true..
[...]
(This invariant was violated for the specific property under test by at least
one implementation as of January 2017.)
---*/
if (Reflect.defineProperty(RegExp, '$1', { writable: false, configurable: false })) {
var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
assert.sameValue(desc.writable, false);
}