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

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

function run_test()
{
  if (!Services.prefs.getBoolPref("javascript.options.experimental.symbols_as_weakmap_keys")) {
    return;
  }

  var strKey = new String("strKey");
  var symKey = Symbol("symKey");

  var weakset = new WeakSet([strKey, symKey]);
  var weakmap = new WeakMap();
  weakmap.set(strKey, 23);
  weakmap.set(symKey, "oh no");

  var keys = ChromeUtils.nondeterministicGetWeakMapKeys(weakmap);
  equal(keys.length, 2, "length of nondeterministicGetWeakMapKeys");
  equal(weakmap.get(strKey), 23, "check strKey in weakmap");
  equal(weakmap.get(symKey), "oh no""check symKey in weakmap");

  keys = ChromeUtils.nondeterministicGetWeakSetKeys(weakset);
  equal(keys.length, 2, "length of nondeterministicGetWeakSetKeys");
  ok(weakset.has(strKey), "check strKey in weakset");
  ok(weakset.has(symKey), "check symKey in weakset");

  strKey = null;
  keys = null;

  Cu.forceGC();

  keys = ChromeUtils.nondeterministicGetWeakMapKeys(weakmap);
  equal(keys.length, 1, "length of nondeterministicGetWeakMapKeys after GC");
  equal(weakmap.get(symKey), "oh no""check symKey still in weakmap");

  keys = ChromeUtils.nondeterministicGetWeakSetKeys(weakset);
  equal(keys.length, 1, "length of nondeterministicGetWeakSetKeys after GC");
  ok(weakset.has(symKey), "check symKey still in weakset");
}

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

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