Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

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.13 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002