summaryrefslogtreecommitdiff
path: root/test/wasm2js/wasm2js.traps.js
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-05-29 10:35:25 -0700
committerGitHub <noreply@github.com>2024-05-29 10:35:25 -0700
commitf622b8e47c69dcbdf2666c795fb3658dc4da52af (patch)
tree27a0c58cb6b932e8251fa6dd2aa68b41f138a1a1 /test/wasm2js/wasm2js.traps.js
parent525f0761496c6aafea80a2d2e8cb709515eb06c5 (diff)
downloadbinaryen-f622b8e47c69dcbdf2666c795fb3658dc4da52af.tar.gz
binaryen-f622b8e47c69dcbdf2666c795fb3658dc4da52af.tar.bz2
binaryen-f622b8e47c69dcbdf2666c795fb3658dc4da52af.zip
Use new wast parser in wasm2js (#6606)
When generating assertions, traverse the `WASTScript` data structure rather than interleaving assertion parsing with emitting.
Diffstat (limited to 'test/wasm2js/wasm2js.traps.js')
-rw-r--r--test/wasm2js/wasm2js.traps.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/wasm2js/wasm2js.traps.js b/test/wasm2js/wasm2js.traps.js
index 8f87e2423..307827362 100644
--- a/test/wasm2js/wasm2js.traps.js
+++ b/test/wasm2js/wasm2js.traps.js
@@ -68,12 +68,12 @@ function check1() {
return 1 | 0;
}
-if (!check1()) throw 'assertion failed: ( assert_return ( invoke empty ) )';
+if (!check1()) throw 'assertion failed on line 9';
function check2() {
return (retasmFunc0.add(1 | 0, 1 | 0) | 0 | 0) == (2 | 0) | 0;
}
-if (!check2()) throw 'assertion failed: ( assert_return ( invoke add ( i32.const 1 ) ( i32.const 1 ) ) ( i32.const 2 ) )';
+if (!check2()) throw 'assertion failed on line 10';
function check3() {
function f() {
return retasmFunc0.div_s(0 | 0, 0 | 0) | 0 | 0;
@@ -82,12 +82,12 @@ function check3() {
try {
f();
} catch (e) {
- return e.message.includes("integer divide by zero");
+ return 1;
};
return 0;
}
-if (!check3()) throw 'assertion failed: ( assert_trap ( invoke div_s ( i32.const 0 ) ( i32.const 0 ) ) integer divide by zero )';
+if (!check3()) throw 'assertion failed on line 11';
function check4() {
function f() {
return retasmFunc0.div_s(-2147483648 | 0, -1 | 0) | 0 | 0;
@@ -96,9 +96,9 @@ function check4() {
try {
f();
} catch (e) {
- return e.message.includes("integer overflow");
+ return 1;
};
return 0;
}
-if (!check4()) throw 'assertion failed: ( assert_trap ( invoke div_s ( i32.const 0x80000000 ) ( i32.const -1 ) ) integer overflow )';
+if (!check4()) throw 'assertion failed on line 12';