Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 26.1.7
5 description: >
6 Use a symbol value on property key.
7 info: |
8 26.1.7 Reflect.getOwnPropertyDescriptor ( target, propertyKey )
9
10 ...
11 2. Let key be ToPropertyKey(propertyKey).
12 ...
13
14 7.1.14 ToPropertyKey ( argument )
15
16 ...
17 3. If Type(key) is Symbol, then
18 a. Return key.
19 ...
20 includes: [compareArray.js]
21 features: [Symbol]
22 ---*/
23
24 var o = {};
25 var s = Symbol('42');
26 o[s] = 42;
27
28 var result = Reflect.getOwnPropertyDescriptor(o, s);
29
30 assert(
31 compareArray(
32 Object.keys(result), ['value', 'writable', 'enumerable', 'configurable']
33 )
34 );
35 assert.sameValue(result.value, 42);
36 assert.sameValue(result.enumerable, true);
37 assert.sameValue(result.configurable, true);
38 assert.sameValue(result.writable, true);