summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/flag-getters.js
blob: fbc1ad72745f42ea180e540d44954db5b1398262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Test inlining for RegExp flag getters.

function testGlobal() {
  const xs = [/a/, /b/g];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.global, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testGlobal();

function testIgnoreCase() {
  const xs = [/a/, /b/i];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.ignoreCase, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testIgnoreCase();

function testMultiline() {
  const xs = [/a/, /b/m];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.multiline, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testMultiline();

function testDotAll() {
  const xs = [/a/, /b/s];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.dotAll, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testDotAll();

function testUnicode() {
  const xs = [/a/, /b/u];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.unicode, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testUnicode();

function testSticky() {
  const xs = [/a/, /b/y];

  for (let i = 0; i < 200; ++i) {
    let x = xs[i & 1];
    assertEq(x.sticky, !!(i & 1));
  }
}
for (let i = 0; i < 2; ++i) testSticky();