Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/delete/11.4.4-4.a-3-s.js

raw
1 // Copyright (c) 2012 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 This test is actually testing the [[Delete]] internal method (8.12.8). Since the
7 language provides no way to directly exercise [[Delete]], the tests are placed here.
8 es5id: 11.4.4-4.a-3-s
9 description: >
10 delete operator throws TypeError when deleting a non-configurable
11 data property in strict mode
12 flags: [onlyStrict]
13 ---*/
14
15 var o = {};
16 var desc = { value : 1 }; // all other attributes default to false
17 Object.defineProperty(o, "foo", desc);
18
19 // Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
20 assert.throws(TypeError, function() {
21 delete o.foo;
22 });