Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/netwerk/test/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_standardurl_port.js   Sprache: JAVA

 
"use strict";

function run_test() {
  function makeURI(aURLSpec, aCharset) {
    return Services.io.newURI(aURLSpec, aCharset);
  }

  var httpURI = makeURI("http://foo.com");
  Assert.equal(-1, httpURI.port);

  // Setting to default shouldn't cause a change
  httpURI = httpURI.mutate().setPort(80).finalize();
  Assert.equal(-1, httpURI.port);

  // Setting to default after setting to non-default shouldn't cause a change (bug 403480)
  httpURI = httpURI.mutate().setPort(123).finalize();
  Assert.equal(123, httpURI.port);
  httpURI = httpURI.mutate().setPort(80).finalize();
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/80/.test(httpURI.spec));

  // URL parsers shouldn't set ports to default value (bug 407538)
  httpURI = httpURI.mutate().setSpec("http://foo.com:81").finalize();
  Assert.equal(81, httpURI.port);
  httpURI = httpURI.mutate().setSpec("http://foo.com:80").finalize();
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/80/.test(httpURI.spec));

  httpURI = makeURI("http://foo.com");
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/80/.test(httpURI.spec));

  httpURI = makeURI("http://foo.com:80");
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/80/.test(httpURI.spec));

  httpURI = makeURI("http://foo.com:80");
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/80/.test(httpURI.spec));

  httpURI = makeURI("https://foo.com");
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/443/.test(httpURI.spec));

  httpURI = makeURI("https://foo.com:443");
  Assert.equal(-1, httpURI.port);
  Assert.ok(!/443/.test(httpURI.spec));

  // XXX URL parsers shouldn't set ports to default value, even when changing scheme?
  // not really possible given current nsIURI impls
  //httpURI.spec = "https://foo.com:443";
  //do_check_eq(-1, httpURI.port);
}

Messung V0.5
C=93 H=97 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.