Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  error.js

  Sprache: JAVA
 

// |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell)

let sr = new ShadowRealm();

try {
    sr.evaluate("throw new Error('hi')");
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/Error: hi/.test(e.message), true"Should have included information from thrown error");
}

try {
    sr.evaluate("throw new Error('∂å∂')");
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/Error: ∂å∂/.test(e.message), true"Should have included information from thrown error, UTF-8 Pass through.");
}

try {
    sr.evaluate("throw {name: 'Hello', message: 'goodbye'}");
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic fillin message, non-string");
}

try {
    sr.evaluate("throw {name: 10, message: 11}");
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic fillin message, non-string");
}


try {
    sr.evaluate("throw { get name() { return 'holy'; }, get message() { return 'smokes' } }");
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic error message, getters");
}

// Wrapped Functions
try {
    var wrapped = sr.evaluate("() => { throw new Error('hi') }");
    assertEq(!!wrapped, true"Wrapped created");
    wrapped();
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/Error: hi/.test(e.message), true"Should have included information from thrown error");
}

try {
    var wrapped = sr.evaluate("() => { throw new Error('∂å∂') } ");
    assertEq(!!wrapped, true"Wrapped created");
    wrapped();
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/Error: ∂å∂/.test(e.message), true"Should have included information from thrown error, UTF-8 Pass through.");
}

try {
    var wrapped = sr.evaluate("() => { throw {name: 'Hello', message: 'goodbye'} } ");
    assertEq(!!wrapped, true"Wrapped created");
    wrapped();
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic error message");
}

try {
    var wrapped = sr.evaluate("() =>  { throw {name: 10, message: 11} } ");
    assertEq(!!wrapped, true"Wrapped created");
    wrapped();
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    print(e.message)
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic error message");
}


try {
    var wrapped = sr.evaluate("() => {  throw { get name() { return 'holy'; }, get message() { return 'smokes' } } } ");
    assertEq(!!wrapped, true"Wrapped created");
    wrapped();
    assertEq(truefalse"Should have thrown");
catch (e) {
    assertEq(e instanceof TypeError, true"Correct type of error")
    assertEq(/uncaught exception: Object/.test(e.message), true"Should get generic error message");
}



if (typeof reportCompare === 'function')
    reportCompare(truetrue);

Messung V0.5 in Prozent
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-06-05) ¤

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

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik