Debian Codegraph @

js/src/tests/test262/built-ins/String/numeric-properties.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-string-exotic-objects-getownproperty-p
5 description: >
6 Property descriptor for numeric "own" properties of an exotic String object
7 info: |
8 [...]
9 12. Let resultStr be a String value of length 1, containing one code unit
10 from str, specifically the code unit at index index.
11 13. Return a PropertyDescriptor{[[Value]]: resultStr, [[Writable]]: false,
12 [[Enumerable]]: true, [[Configurable]]: false}.
13 includes: [propertyHelper.js]
14 ---*/
15
16 var str = new String('abc');
17
18 assert.sameValue(str[0], 'a');
19 verifyProperty(str, '0', {
20 writable: false,
21 enumerable: true,
22 configurable: false,
23 });
24
25 assert.sameValue(str[1], 'b');
26 verifyProperty(str, '1', {
27 writable: false,
28 enumerable: true,
29 configurable: false,
30 });
31
32 assert.sameValue(str[2], 'c');
33 verifyProperty(str, '2', {
34 writable: false,
35 enumerable: true,
36 configurable: false,
37 });
38
39 reportCompare(0, 0);