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

Quelle  weakRefs-basic.js   Sprache: JAVA

 
assertEq('WeakRef' in thistrue);

function checkPropertyDescriptor(obj, property, writable, enumerable,
                                 configurable) {
  let desc = Object.getOwnPropertyDescriptor(obj, property);
  assertEq(typeof desc, "object");
  assertEq(desc.writable, writable);
  assertEq(desc.enumerable, enumerable);
  assertEq(desc.configurable, configurable);
}

function assertThrowsTypeError(thunk) {
  let error;
  try {
      thunk();
  } catch (e) {
      error = e;
  }
  assertEq(error instanceof TypeError, true);
}

assertEq(typeof this.WeakRef, "function");

// https://tc39.es/proposal-weakrefs/

// 1.1.1.1
// If NewTarget is undefined, throw a TypeError exception.
assertThrowsTypeError(() => new WeakRef());

// 1.1.1.2
// If Type(target) is not Object, throw a TypeError exception.
assertThrowsTypeError(() => new WeakRef(1));
assertThrowsTypeError(() => new WeakRef(true));
assertThrowsTypeError(() => new WeakRef("string"));
assertThrowsTypeError(() => new WeakRef(Symbol()));
assertThrowsTypeError(() => new WeakRef(null));
assertThrowsTypeError(() => new WeakRef(undefined));
new WeakRef({});

// 1.2
// The WeakRef constructor has a [[Prototype]] internal slot whose value is the
// intrinsic object %FunctionPrototype%.
assertEq(Object.getPrototypeOf(WeakRef), Function.prototype);

// 1.2.1
// The initial value of WeakRef.prototype is the intrinsic %WeakRefPrototype%
// object.
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false
// , [[Configurable]]: false }.
checkPropertyDescriptor(WeakRef, 'prototype'falsefalsefalse);

// 1.3
// The WeakRef prototype object has a [[Prototype]] internal slot whose value is
// the intrinsic object %ObjectPrototype%.
let proto = WeakRef.prototype;
assertEq(Object.getPrototypeOf(proto), Object.prototype);

// 1.3.1
// The initial value of WeakRef.prototype.constructor is the intrinsic object
// %WeakRef%.
assertEq(proto.constructor, WeakRef);

// 1.3.2
// WeakRef.prototype.deref ()
assertEq(proto.hasOwnProperty('deref'), true);
assertEq(typeof proto.deref, 'function');

// 1.3.3
// The initial value of the @@toStringTag property is the String value
// "WeakRef".
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
// [[Configurable]]: true }.
assertEq(proto[Symbol.toStringTag], "WeakRef");
checkPropertyDescriptor(proto, Symbol.toStringTag, falsefalsetrue);

// 1.4
// WeakRef instances are ordinary objects that inherit properties from the
// WeakRef prototype
let weakRef = new WeakRef({});
assertEq(Object.getPrototypeOf(weakRef), proto);


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

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