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

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

var listFormat = new Intl.ListFormat(locale);
var scwListFormat = wrapWithProto(listFormat, Intl.ListFormat.prototype);

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

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

    assertEq(actualValue, expectedValue);
}

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

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

    assertDeepEq(actualValue, expectedValue);
}

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

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

    assertDeepEq(actualValue, expectedValue);
}

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