Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/fuses/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  regexp-6.js

  Sprache: JAVA
 

// Tests for String.prototype builtins with custom regexp symbols on
// RegExp.prototype.
// Use fresh globals because this pops realm fuses.

// Custom RegExp.prototype[@@match].
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.match(re);
    if (i === 150) {
      RegExp.prototype[Symbol.match] = function() {
        count++;
        return null;
      };
    }
  }
  assertEq(count, 49);
})();`);

// Custom RegExp.prototype[@@matchAll].
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/g;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.matchAll(re);
    if (i === 150) {
      RegExp.prototype[Symbol.matchAll] = function() {
        count++;
        return null;
      };
    }
  }
  assertEq(count, 49);
})();`);

// Custom RegExp.prototype[@@replace] for replace.
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.replace(re, "");
    if (i === 150) {
      RegExp.prototype[Symbol.replace] = function() {
        count++;
        return "";
      };
    }
  }
  assertEq(count, 49);
})();`);

// Custom RegExp.prototype[@@replace] for replaceAll.
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/g;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.replaceAll(re, "");
    if (i === 150) {
      RegExp.prototype[Symbol.replace] = function() {
        count++;
        return "";
      };
    }
  }
  assertEq(count, 49);
})();`);

// Custom RegExp.prototype[@@search].
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/g;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.search(re);
    if (i === 150) {
      RegExp.prototype[Symbol.search] = function() {
        count++;
        return -1;
      };
    }
  }
  assertEq(count, 49);
})();`);

// Custom RegExp.prototype[@@split].
newGlobal().evaluate(`(function() {
  var s = "foobar";
  var re = /abc.+/;
  var count = 0;
  for (var i = 0; i < 200; i++) {
    s.split(re);
    if (i === 150) {
      RegExp.prototype[Symbol.split] = function() {
        count++;
        return [];
      };
    }
  }
  assertEq(count, 49);
})();`);

Messung V0.5 in Prozent
C=92 H=79 G=85

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-08-25) ¤

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