Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/tests/non262/Intl/Collator/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  call.js   Sprache: JAVA

 
// |reftest| skip-if(!this.hasOwnProperty("Intl"))

function IsIntlService(c) {
    return typeof c === "function" &&
           c.hasOwnProperty("prototype") &&
           c.prototype.hasOwnProperty("resolvedOptions");
}

function IsObject(o) {
    return Object(o) === o;
}

function thisValues() {
    const intlConstructors = Object.getOwnPropertyNames(Intl).map(name => Intl[name]).filter(IsIntlService);

    return [
        // Primitive values.
        ...[undefined, nulltrue"abc", Symbol(), 123],

        // Object values.
        ...[{}, [], /(?:)/, function(){}, new Proxy({}, {})],

        // Intl objects.
        ...[].concat(...intlConstructors.map(ctor => {
            let args = [];
            if (ctor === Intl.DisplayNames) {
                // Intl.DisplayNames can't be constructed without any arguments.
                args = [undefined, {type: "language"}];
            }

            return [
                // Instance of an Intl constructor.
                new ctor(...args),

                // Instance of a subclassed Intl constructor.
                new class extends ctor {}(...args),

                // Object inheriting from an Intl constructor prototype.
                Object.create(ctor.prototype),

                // Intl object not inheriting from its default prototype.
                Object.setPrototypeOf(new ctor(...args), Object.prototype),
            ];
        })),
    ];
}

// Invoking [[Call]] for Intl.Collator always returns a new Collator instance.
for (let thisValue of thisValues()) {
    let obj = Intl.Collator.call(thisValue);
    assertEq(Object.is(obj, thisValue), false);
    assertEq(obj instanceof Intl.Collator, true);

    // Ensure Intl.[[FallbackSymbol]] wasn't installed on |thisValue|.
    if (IsObject(thisValue))
        assertEqArray(Object.getOwnPropertySymbols(thisValue), []);
}

// Intl.Collator doesn't use the legacy Intl constructor compromise semantics.
for (let thisValue of thisValues()) {
    // Ensure instanceof operator isn't invoked for Intl.Collator.
    Object.defineProperty(Intl.Collator, Symbol.hasInstance, {
        get() {
            assertEq(falsetrue"@@hasInstance operator called");
        }, configurable: true
    });
    let obj = Intl.Collator.call(thisValue);
    delete Intl.Collator[Symbol.hasInstance];
    assertEq(Object.is(obj, thisValue), false);
    assertEq(obj instanceof Intl.Collator, true);
}

if (typeof reportCompare === "function")
    reportCompare(truetrue);

Messung V0.5
C=90 H=92 G=90

¤ Dauer der Verarbeitung: 0.21 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.