Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Unified Diff: test/mjsunit/wasm/wasm-constants.js

Issue 2525313003: [mjsunit] Change assertThrows such that it can check the exception message. (Closed)
Patch Set: assertTraps actually exists in wasm-constants.js Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/wasm/divrem-trap.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « test/mjsunit/wasm/divrem-trap.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698