Debian Codegraph @

js/src/tests/test262/language/statements/for-of/string-astral.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 /*---
5 description: String traversal using for..of (astral symbols)
6 info: |
7 String literals should be able to be traversed using a `for...of` loop. The
8 loop body should execute once for each astral symbol.
9 es6id: 13.6.4
10 ---*/
11
12 var string = 'a\ud801\udc28b\ud801\udc28';
13 var first = 'a';
14 var second = '𐐨';
15 var third = 'b';
16 var fourth = '𐐨';
17
18 var iterationCount = 0;
19
20 for (var value of string) {
21 assert.sameValue(value, first);
22 first = second;
23 second = third;
24 third = fourth;
25 fourth = null;
26 iterationCount += 1;
27 }
28
29 assert.sameValue(iterationCount, 4);
30
31 reportCompare(0, 0);