Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js

raw
1 // Copyright (C) 2016 Jordan Harband. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Object.getOwnPropertyDescriptors accepts string primitives.
6 esid: sec-object.getownpropertydescriptors
7 author: Jordan Harband
8 ---*/
9
10 var result = Object.getOwnPropertyDescriptors('abc');
11
12 assert.sameValue(Object.keys(result).length, 4, 'string has 4 descriptors');
13
14 assert.sameValue(result.length.configurable, false, 'length is not configurable');
15 assert.sameValue(result.length.enumerable, false, 'length is not enumerable');
16 assert.sameValue(result.length.writable, false, 'length is not writable');
17 assert.sameValue(result.length.value, 3, 'length is 3');
18
19 assert.sameValue(result[0].configurable, false, 'index 0 is not configurable');
20 assert.sameValue(result[0].enumerable, true, 'index 0 is enumerable');
21 assert.sameValue(result[0].writable, false, 'index 0 is not writable');
22 assert.sameValue(result[0].value, 'a', 'index 0 is "a"');
23
24 assert.sameValue(result[1].configurable, false, 'index 1 is not configurable');
25 assert.sameValue(result[1].enumerable, true, 'index 1 is enumerable');
26 assert.sameValue(result[1].writable, false, 'index 1 is not writable');
27 assert.sameValue(result[1].value, 'b', 'index 1 is "b"');
28
29 assert.sameValue(result[2].configurable, false, 'index 2 is not configurable');
30 assert.sameValue(result[2].enumerable, true, 'index 2 is enumerable');
31 assert.sameValue(result[2].writable, false, 'index 2 is not writable');
32 assert.sameValue(result[2].value, 'c', 'index 2 is "c"');