aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/html/content/harness.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/html/content/harness.js')
-rw-r--r--src/test/html/content/harness.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/html/content/harness.js b/src/test/html/content/harness.js
index ade4536a879..72aa2712469 100644
--- a/src/test/html/content/harness.js
+++ b/src/test/html/content/harness.js
@@ -37,6 +37,24 @@ function is_function(val, name) {
starts_with(String(val), "function " + name + "(");
}
+function should_throw(f) {
+ try {
+ f();
+ _fail("operation should have thrown but did not");
+ } catch (x) {
+ _pass("operation successfully threw an exception", x.toString());
+ }
+}
+
+function should_not_throw(f) {
+ try {
+ f();
+ _pass("operation did not throw an exception");
+ } catch (x) {
+ _fail("operation should have not thrown", x.toString());
+ }
+}
+
var _test_complete = false;
var _test_timeout = 10000; //10 seconds
function finish() {