зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305444 - Add test for dispatched method throwing an error; r=Yoric
We didn't have explicit test coverage of this before, surprisingly. MozReview-Commit-ID: 32ZnxZYLXDg --HG-- extra : rebase_source : 07110ed90b69c5b0fb73fda8264db2eb755ca6a4
This commit is contained in:
Родитель
2b829e24bb
Коммит
90f5226666
|
@ -26,5 +26,9 @@ self.addEventListener("message", msg => worker.handleMessage(msg));
|
||||||
var Agent = {
|
var Agent = {
|
||||||
bounce: function(...args) {
|
bounce: function(...args) {
|
||||||
return args;
|
return args;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
throwError: function(msg, ...args) {
|
||||||
|
throw new Error(msg);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -106,3 +106,12 @@ add_task(function* test_transfer_with_meta() {
|
||||||
Assert.equal(result[i], i);
|
Assert.equal(result[i], i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
add_task(function* test_throw_error() {
|
||||||
|
try {
|
||||||
|
yield worker.post("throwError", ["error message"]);
|
||||||
|
Assert.ok(false, "should have thrown");
|
||||||
|
} catch (ex) {
|
||||||
|
Assert.equal(ex.message, "Error: error message");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче