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

Quelle  toLocaleUpperCase.js   Sprache: JAVA

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

// Test language dependent special casing with different language tags.
for (let locale of ["lt""LT""lt-LT""lt-u-co-phonebk""lt-x-lietuva"]) {
    assertEq("i\u0307".toLocaleUpperCase(locale), "I");
    assertEq("i\u0307".toLocaleUpperCase([locale]), "I");

    // Additional language tags are ignored.
    assertEq("i\u0307".toLocaleUpperCase([locale, "und"]), "I");
    assertEq("i\u0307".toLocaleUpperCase(["und", locale]), "I\u0307");
}

// Ensure "lti" (Leti) isn't misrecognized as "lt", even though both share the
// same prefix.
assertEq("i\u0307".toLocaleUpperCase("lti"), "I\u0307");
assertEq("i\u0307".toLocaleUpperCase(["lti"]), "I\u0307");

// Language tag is always verified.
for (let locale of ["no_locale""lt-invalid_ext", ["no_locale"], ["en""no_locale"]]) {
    // Empty input string.
    assertThrowsInstanceOf(() => "".toLocaleUpperCase(locale), RangeError);

    // Non-empty input string.
    assertThrowsInstanceOf(() => "a".toLocaleUpperCase(locale), RangeError);
}

// No locale argument, undefined as locale, and empty array or array-like all
// return the same result. Testing with "a/A" because it has only simple case
// mappings.
assertEq("a".toLocaleUpperCase(), "A");
assertEq("a".toLocaleUpperCase(undefined), "A");
assertEq("a".toLocaleUpperCase([]), "A");
assertEq("a".toLocaleUpperCase({}), "A");
assertEq("a".toLocaleUpperCase({length: 0}), "A");
assertEq("a".toLocaleUpperCase({length: -1}), "A");

// Test with incorrect locale type.
for (let locale of [null, 0, Math.PI, NaN, Infinity, truefalse, Symbol()]) {
    // Empty input string.
    assertThrowsInstanceOf(() => "".toLocaleUpperCase([locale]), TypeError);

    // Non-empty input string.
    assertThrowsInstanceOf(() => "a".toLocaleUpperCase([locale]), TypeError);
}

// Primitives are converted with ToObject and then queried for .length property.
for (let locale of [null]) {
    // Empty input string.
    assertThrowsInstanceOf(() => "".toLocaleUpperCase([locale]), TypeError);

    // Non-empty input string.
    assertThrowsInstanceOf(() => "a".toLocaleUpperCase([locale]), TypeError);
}
// ToLength(ToObject(<primitive>)) returns 0.
for (let locale of [0, Math.PI, NaN, Infinity, truefalse, Symbol()]) {
    // Empty input string.
    assertEq("".toLocaleUpperCase(locale), "");

    // Non-empty input string.
    assertEq("a".toLocaleUpperCase(locale), "A");
}

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

Messung V0.5
C=91 H=96 G=93

¤ 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.