Bug 877178 - Add an exception checking method to SimpleTest, r=robcee

This commit is contained in:
Gijs Kruitbosch 2013-06-01 15:33:03 +02:00
parent 37eed26117
commit 397e911113

View File

@ -260,6 +260,17 @@ SimpleTest.ise = function (a, b, name) {
SimpleTest.ok(pass, name, diag);
};
/**
* Check that the function call throws an exception.
*/
SimpleTest.doesThrow = function(fn, name) {
var gotException = false;
try {
fn();
} catch (ex) { gotException = true; }
ok(gotException, name);
};
// --------------- Test.Builder/Test.More todo() -----------------
SimpleTest.todo = function(condition, name, diag) {