summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/tagTempl.js
blob: 7d06b0e8f6a02de5f5a74b9a25bd159cb3e2bcc1 (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
/*
 * Tests tagged template string functionality.
 */

function check(actual, expected) {
    assertEq(actual.length, expected.length);
    for (var i = 0; i < expected.length; i++)
       assertEq(actual[i], expected[i]);
}

function func(a) { return a; }

function csoLoop() {
    var cso = [];
    for (var index = 0; index < 2000; index++) {
        cso[index] = func`hey${4}there`;
        if (index > 0)
            assertEq(cso[index - 1], cso[index]);
    }
}

// Tests baseline and ion functionality.
csoLoop();

// Tests off thread compilation
if (helperThreadCount() !== 0) {
    offThreadCompileScript("(x=>x)`abc`");
    a = runOffThreadScript();
    check(a, ["abc"]);
    check(a.raw, ["abc"]);
    assertEq(a === a.raw, false);
    assertEq(Object.isFrozen(a), true);
    assertEq(Object.isFrozen(a.raw), true);
}