Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/seal/15.2.3.8-2-b-4.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 es5id: 15.2.3.8-2-b-4
6 description: >
7 Object.seal - all own properties of 'O' are already
8 non-configurable
9 includes: [propertyHelper.js]
10 ---*/
11
12 var obj = {};
13 obj.variableForHelpVerify = "data";
14
15 Object.defineProperty(obj, "foo1", {
16 value: 10,
17 writable: true,
18 enumerable: true,
19 configurable: false
20 });
21
22 function set_func(value) {
23 obj.variableForHelpVerify = value;
24 }
25
26 function get_func() {
27 return 10;
28 }
29 Object.defineProperty(obj, "foo2", {
30 get: get_func,
31 set: set_func,
32 enumerable: true,
33 configurable: false
34 });
35
36 if (!Object.isExtensible(obj)) {
37 $ERROR('Expected obj to be extensible, actually ' + Object.isExtensible(obj));
38 }
39
40 Object.seal(obj);
41
42 if (Object.isExtensible(obj)) {
43 $ERROR('Expected obj NOT to be extensible, actually ' + Object.isExtensible(obj));
44 }
45
46 verifyEqualTo(obj, "foo1", 10);
47
48 verifyWritable(obj, "foo1");
49
50 verifyEnumerable(obj, "foo1");
51
52 verifyNotConfigurable(obj, "foo1");
53 verifyEqualTo(obj, "foo2", get_func());
54
55 verifyWritable(obj, "foo2", "variableForHelpVerify");
56
57 verifyEnumerable(obj, "foo2");
58
59 verifyNotConfigurable(obj, "foo2");