Debian Codegraph @

js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3-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 info: |
7 This test is actually testing the [[Delete]] internal method (8.12.8). Since the
8 language provides no way to directly exercise [[Delete]], the tests are placed here.
9 esid: sec-delete-operator-runtime-semantics-evaluation
10 description: >
11 delete operator throws TypeError when deleting a non-configurable
12 data property in strict mode
13 flags: [onlyStrict]
14 ---*/
15
16 var o = {};
17 var desc = {
18 value: 1,
19 }; // all other attributes default to false
20 Object.defineProperty(o, 'foo', desc);
21
22 // Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
23 assert.throws(TypeError, function() {
24 delete o.foo;
25 });
26
27 reportCompare(0, 0);