Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/basic/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 691 B image not shown  

Quelle  splice-fail-step-16.js

  Sprache: JAVA
 

/* Test that arrays resize normally during splice, even if .length is non-writable. */

var arr = [123456];

Object.defineProperty(arr, "length", {writable: false});

try
{
  var removed = arr.splice(339999);
  throw new Error("splice didn't throw, returned [" + removed + "]");
}
catch (e)
{
  assertEq(e instanceof TypeError, true,
           "should have thrown a TypeError, instead threw " + e + ", arr is " + arr);
}

// The exception should happen in step 16, which means we've already removed the array elements.
assertEq(arr[0], 1);
assertEq(arr[1], 2);
assertEq(arr[2], 3);
assertEq(arr[3], 9);
assertEq(arr[4], 9);
assertEq(arr[5], 9);
assertEq(arr.length, 6);

Messung V0.5 in Prozent
C=91 H=89 G=89

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.