Debian Codegraph @

js/src/tests/test262/language/statements/for-of/string-bmp.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
6 info: |
7 String literals should be able to be traversed using a `for...of` loop. The
8 loop body should execute once for every BMP character.
9 es6id: 13.6.4
10 ---*/
11
12 var string = 'abc';
13 var first = 'a';
14 var second = 'b';
15 var third = 'c';
16
17 var iterationCount = 0;
18
19 for (var value of string) {
20 assert.sameValue(value, first);
21 first = second;
22 second = third;
23 third = null;
24 iterationCount += 1;
25 }
26
27 assert.sameValue(iterationCount, 3);
28
29 reportCompare(0, 0);