Debian Codegraph @

js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3.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 esid: sec-delete-operator-runtime-semantics-evaluation
9 description: >
10 delete operator returns false when deleting a non-configurable
11 data property
12 flags: [noStrict]
13 ---*/
14
15 var o = {};
16 var desc = {
17 value: 1,
18 configurable: false,
19 }; // all other attributes default to false
20 Object.defineProperty(o, 'foo', desc);
21
22 // Now, deleting o.foo should fail because [[Configurable]] on foo is false.
23 var d = delete o.foo;
24
25 assert.sameValue(d, false, 'd');
26 assert.sameValue(o.hasOwnProperty('foo'), true, 'o.hasOwnProperty("foo")');
27
28 reportCompare(0, 0);