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


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
C=88 H=94 G=90

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge