summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/string-substring-is-charat.js
blob: 0675aa202995580f1596e8b37e786c14046b097b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// |str.substring(0, 1)| is compiled as |str.charAt(0)|.

const strings = [
  "",
  "a", "b",
  "ab", "ba",
];

for (let i = 0; i < 1000; ++i) {
  let str = strings[i % strings.length];

  assertEq(str.substring(0, 1), str.charAt(0));
}