From 9e9756ee85aed46365dd0d83d881c1a4c90e7296 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sat, 22 Apr 2023 09:25:22 -0300 Subject: [PATCH] Split off into try-br-interactions --- test/core/try-br-interactions.wast | 65 ++++++++++++++++++++++++++++++ test/core/try_delegate.wast | 22 ---------- 2 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 test/core/try-br-interactions.wast diff --git a/test/core/try-br-interactions.wast b/test/core/try-br-interactions.wast new file mode 100644 index 00000000..435fdc1e --- /dev/null +++ b/test/core/try-br-interactions.wast @@ -0,0 +1,65 @@ +;; Test try-br interactions. + +(module + (tag $e0) + + (func $throw (throw $e0)) + + (func (export "break-try-catch") + (try (do (br 0)) (catch $e0)) + ) + + (func (export "break-try-catch_all") + (try (do (br 0)) (catch_all)) + ) + + (func (export "break-try-delegate") + (try (do (br 0)) (delegate 0)) + ) + + (func (export "break-and-call-throw") (result i32) + (try $outer (result i32) + (do + (try (result i32) + (do + (block $a + (try (do (br $a)) (delegate $outer)) + ) + (call $throw) + (i32.const 0) + ) + (catch $e0 (i32.const 1)) + ) + ) + (catch $e0 (i32.const 2)) + ) + ) + + (func (export "break-and-throw") (result i32) + (try $outer (result i32) + (do + (try (result i32) + (do + (block $a + (try (do (br $a)) (delegate $outer)) + ) + (throw $e0) + (i32.const 0) + ) + (catch $e0 (i32.const 1)) + ) + ) + (catch $e0 (i32.const 2)) + ) + ) +) + +(assert_return (invoke "break-try-catch")) + +(assert_return (invoke "break-try-catch_all")) + +(assert_return (invoke "break-try-delegate")) + +(assert_return (invoke "break-and-call-throw") (i32.const 1)) + +(assert_return (invoke "break-and-throw") (i32.const 1)) diff --git a/test/core/try_delegate.wast b/test/core/try_delegate.wast index 62920aa6..8ee864eb 100644 --- a/test/core/try_delegate.wast +++ b/test/core/try_delegate.wast @@ -115,26 +115,6 @@ (delegate $l3)))) unreachable) (catch_all (i32.const 1)))) - - (func $throw (throw $e0)) - - (func (export "break-throw") (result i32) - (try $outer (result i32) - (do - (try (result i32) - (do - (block $a - (try (do (br $a)) (delegate $outer)) - ) - (call $throw) - (i32.const 0) - ) - (catch $e0 (i32.const 1)) - ) - ) - (catch $e0 (i32.const 2)) - ) - ) ) (assert_return (invoke "delegate-no-throw") (i32.const 1)) @@ -160,8 +140,6 @@ (assert_return (invoke "delegate-correct-targets") (i32.const 1)) -(assert_return (invoke "break-throw") (i32.const 1)) - (assert_malformed (module quote "(module (func (delegate 0)))") "unexpected token"