summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug1827072.js
blob: 9e47c26cd76c1a556ee9076fe8d7675a353ad8c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
assertThrows(() => newString("", { capacity: 1 }));
assertThrows(() => newString("x", { capacity: 2 }));

// Too large for an inline string.
const nonInlineLinear = "123456789012345678901234567890";
assertEq(nonInlineLinear.length, 30);

newString(nonInlineLinear, { capacity: 29, tenured: true });
newString(nonInlineLinear, { capacity: 30, tenured: true });
newString(nonInlineLinear, { capacity: 31, tenured: true });

function assertThrows(f) {
  try {
    f();
  } catch {
    return;
  }
  throw new Error("missing error");
}