summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Intl/ListFormat/cross-compartment.js
blob: 37c45ef75c42a90e93170255bc58ce882ba6d3d5 (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
// |reftest| skip-if(!this.hasOwnProperty('Intl'))

var g = newGlobal();

var locale = "en";
var list = ["a", "b", "c"];

var listFormat = new Intl.ListFormat(locale);
var ccwListFormat = new g.Intl.ListFormat(locale);

// Intl.ListFormat.prototype.format
{
    var fn = Intl.ListFormat.prototype.format;

    var expectedValue = fn.call(listFormat, list);
    var actualValue = fn.call(ccwListFormat, list);

    assertEq(actualValue, expectedValue);
}

// Intl.ListFormat.prototype.formatToParts
{
    var fn = Intl.ListFormat.prototype.formatToParts;

    var expectedValue = fn.call(listFormat, list);
    var actualValue = fn.call(ccwListFormat, list);

    assertDeepEq(actualValue, expectedValue);
}

// Intl.ListFormat.prototype.resolvedOptions
{
    var fn = Intl.ListFormat.prototype.resolvedOptions;

    var expectedValue = fn.call(listFormat);
    var actualValue = fn.call(ccwListFormat);

    assertDeepEq(actualValue, expectedValue);
}

if (typeof reportCompare === "function")
    reportCompare(0, 0);