Index: test/mjsunit/wasm/wasm-constants.js |
diff --git a/test/mjsunit/wasm/wasm-constants.js b/test/mjsunit/wasm/wasm-constants.js |
index a064d55aaf8de9a23ad537f18f4c675f94211088..068767bc829e2091b324c5bf2e54702aa4208f9b 100644 |
--- a/test/mjsunit/wasm/wasm-constants.js |
+++ b/test/mjsunit/wasm/wasm-constants.js |
@@ -339,22 +339,9 @@ let kTrapMsgs = [ |
"invalid index into function table" |
]; |
+ |
function assertTraps(trap, code) { |
- var threwException = true; |
- try { |
- if (typeof code === 'function') { |
- code(); |
- } else { |
- eval(code); |
- } |
- threwException = false; |
- } catch (e) { |
- assertEquals("object", typeof e); |
- assertEquals(kTrapMsgs[trap], e.message); |
- // Success. |
- return; |
- } |
- throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]); |
+ assertThrows(code, WebAssembly.RuntimeError, kTrapMsgs[trap]); |
} |
function assertWasmThrows(value, code) { |