diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 33 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 15 |
2 files changed, 46 insertions, 2 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index b45039c69..359203e8b 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -336,8 +336,11 @@ void test_core() { BinaryenExpressionRef catchBody = BinaryenDrop(module, BinaryenPop(module, BinaryenTypeInt32())); BinaryenExpressionRef catchAllBody = BinaryenNop(module); - BinaryenExpressionRef catchBodies[] = {catchBody, catchAllBody}; const char* catchEvents[] = {"a-event"}; + BinaryenExpressionRef catchBodies[] = {catchBody, catchAllBody}; + const char* emptyCatchEvents[] = {}; + BinaryenExpressionRef emptyCatchBodies[] = {}; + BinaryenExpressionRef nopCatchBody[] = {BinaryenNop(module)}; BinaryenType i32 = BinaryenTypeInt32(); BinaryenType i64 = BinaryenTypeInt64(); @@ -727,7 +730,33 @@ void test_core() { BinaryenRefNull(module, BinaryenTypeEqref()), BinaryenRefNull(module, BinaryenTypeEqref())), // Exception handling - BinaryenTry(module, tryBody, catchEvents, 1, catchBodies, 2), + BinaryenTry(module, NULL, tryBody, catchEvents, 1, catchBodies, 2, NULL), + // (try $try_outer + // (do + // (try + // (do + // (throw $a-event (i32.const 0)) + // ) + // (delegate $try_outer) + // ) + // ) + // (catch_all) + // ) + BinaryenTry(module, + "try_outer", + BinaryenTry(module, + NULL, + tryBody, + emptyCatchEvents, + 0, + emptyCatchBodies, + 0, + "try_outer"), + emptyCatchEvents, + 0, + nopCatchBody, + 1, + NULL), // Atomics BinaryenAtomicStore( module, diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index f03e4ec6c..c3226690e 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1775,6 +1775,21 @@ BinaryenFeatureAll: 8191 (nop) ) ) + (try $try_outer + (do + (try + (do + (throw $a-event + (i32.const 0) + ) + ) + (delegate $try_outer) + ) + ) + (catch_all + (nop) + ) + ) (i32.atomic.store (i32.const 0) (i32.atomic.load |