Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/String/raw/template-substitutions-are-appended-on-same-index.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: 21.1.2.4
5 description: >
6 Returns the string value appending from the same index order using String.raw
7 as a tag function.
8 info: |
9 21.1.2.4 String.raw ( template , ...substitutions )
10
11 ...
12 10. Let stringElements be a new List.
13 11. Let nextIndex be 0.
14 12. Repeat
15 a. Let nextKey be ToString(nextIndex).
16 b. Let nextSeg be ToString(Get(raw, nextKey)).
17 c. ReturnIfAbrupt(nextSeg).
18 d. Append in order the code unit elements of nextSeg to the end of
19 stringElements.
20 e. If nextIndex + 1 = literalSegments, then
21 i. Return the String value whose code units are, in order, the elements in
22 the List stringElements. If stringElements has no elements, the empty
23 string is returned.
24 f. If nextIndex < numberOfSubstitutions, let next be substitutions[nextIndex].
25 g. Else, let next be the empty String.
26 h. Let nextSub be ToString(next).
27 i. ReturnIfAbrupt(nextSub).
28 j. Append in order the code unit elements of nextSub to the end of stringElements.
29 k. Let nextIndex be nextIndex + 1.
30 ---*/
31
32 assert.sameValue(String.raw`1${2}3${4}5`, '12345');