Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/intl/uconv/tests/unit/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  test_unEscapeNonAsciiURI.js   Sprache: JAVA

 
// Tests for nsITextToSubURI.unEscapeNonAsciiURI
function run_test() {
  // Tests whether nsTextToSubURI does UTF-16 unescaping (it shouldn't)
  const testURI = "data:text/html,%FE%FF";
  Assert.equal(
    Services.textToSubURI.unEscapeNonAsciiURI("UTF-16", testURI),
    testURI
  );

  // Tests whether incomplete multibyte sequences throw.
  const tests = [
    {
      input: "http://example.com/?p=%E9",
      throws: Cr.NS_ERROR_ILLEGAL_INPUT,
    },
    {
      input: "http://example.com/?p=%E9%80",
      throws: Cr.NS_ERROR_ILLEGAL_INPUT,
    },
    {
      input: "http://example.com/?p=%E9%80%80",
      expected: "http://example.com/?p=\u9000",
    },
    {
      input: "http://example.com/?p=%E9e",
      throws: Cr.NS_ERROR_ILLEGAL_INPUT,
    },
    {
      input: "http://example.com/?p=%E9%E9",
      throws: Cr.NS_ERROR_ILLEGAL_INPUT,
    },
    {
      input: "http://example.com/?name=M%FCller/",
      throws: Cr.NS_ERROR_ILLEGAL_INPUT,
    },
    {
      input: "http://example.com/?name=M%C3%BCller/",
      expected: "http://example.com/?name=Müller/",
    },
  ];

  for (const t of tests) {
    if (t.throws !== undefined) {
      let thrown = undefined;
      try {
        Services.textToSubURI.unEscapeNonAsciiURI("UTF-8", t.input);
      } catch (e) {
        thrown = e.result;
      }
      Assert.equal(thrown, t.throws);
    } else {
      Assert.equal(
        Services.textToSubURI.unEscapeNonAsciiURI("UTF-8", t.input),
        t.expected
      );
    }
  }
}

Messung V0.5
C=92 H=81 G=86

¤ Dauer der Verarbeitung: 0.24 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.