blob: 1ea8e36c313f10d3d79f6053f78fe5c452910dab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// `str.substring(...)` can return static strings.
const strings = [
"abcdef",
"ABCDEF",
];
for (let i = 0; i < 500; ++i) {
let str = strings[i & 1];
for (let j = 0; j < 2; ++j) {
// One element static string.
let r = str.substring(j, j + 1);
assertEq(r, str.charAt(j));
// Two elements static string.
let s = str.substring(j, j + 2);
assertEq(s, str.charAt(j) + str.charAt(j + 1));
}
}
|