summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/string-substring-latin1rope-with-twobyte-children.js
blob: 3a1d8890733baf9610b4b77c6f9bf6a2e6c328af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
let right = newRope("b", "012345678901234567890123456789");
let latin1Rope = newRope("a", right);
let twoByteRope = newRope("\u221e", right);

// Flattening |twoByteRope| changes |right| from a Latin-1 rope into a two-byte
// dependent string. At this point, |latin1Rope| has the Latin-1 flag set, but
// also has a two-byte rope child.
ensureLinearString(twoByteRope);

let result = latin1Rope.substring(0, 3);

assertEq(result, "ab0");