summaryrefslogtreecommitdiff
path: root/test/spec-wasm2c-prefix.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec-wasm2c-prefix.c')
-rw-r--r--test/spec-wasm2c-prefix.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/spec-wasm2c-prefix.c b/test/spec-wasm2c-prefix.c
index 4415be6f..8e570588 100644
--- a/test/spec-wasm2c-prefix.c
+++ b/test/spec-wasm2c-prefix.c
@@ -25,6 +25,17 @@ static void error(const char* file, int line, const char* format, ...) {
va_end(args);
}
+#define ASSERT_EXCEPTION(f) \
+ do { \
+ g_tests_run++; \
+ if (wasm_rt_impl_try() == WASM_RT_TRAP_UNCAUGHT_EXCEPTION) { \
+ g_tests_passed++; \
+ } else { \
+ (void)(f); \
+ error(__FILE__, __LINE__, "expected " #f " to throw exception.\n"); \
+ } \
+ } while (0)
+
#define ASSERT_TRAP(f) \
do { \
g_tests_run++; \