summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Array/toLocaleString-nointl.js
blob: b0cee830497100c239e81d1a2aaebf5c06da3a6e (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
if (typeof Intl !== "object") {
    const localeSep = [,,].toLocaleString();

    const obj = {
        toLocaleString() {
            assertEq(arguments.length, 0);
            return "pass";
        }
    };

    // Ensure no arguments are passed to the array elements.
    // - Single element case.
    assertEq([obj].toLocaleString(), "pass");
    // - More than one element.
    assertEq([obj, obj].toLocaleString(), "pass" + localeSep + "pass");

    // Ensure no arguments are passed to the array elements even if supplied.
    const locales = {}, options = {};
    // - Single element case.
    assertEq([obj].toLocaleString(locales, options), "pass");
    // - More than one element.
    assertEq([obj, obj].toLocaleString(locales, options), "pass" + localeSep + "pass");
}

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