From 9f16cd168b25e7ce7e6e1040283fac73b4722c11 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Tue, 25 Apr 2023 07:27:43 -0300 Subject: [PATCH] Move to existing test files --- test/core/try-br-interactions.wast | 65 ------------------------------ test/core/try_catch.wast | 14 +++++++ test/core/try_delegate.wast | 47 +++++++++++++++++++++ 3 files changed, 61 insertions(+), 65 deletions(-) delete mode 100644 test/core/try-br-interactions.wast diff --git a/test/core/try-br-interactions.wast b/test/core/try-br-interactions.wast deleted file mode 100644 index 435fdc1e..00000000 --- a/test/core/try-br-interactions.wast +++ /dev/null @@ -1,65 +0,0 @@ -;; 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_catch.wast b/test/core/try_catch.wast index 6564e201..72e3a7c4 100644 --- a/test/core/try_catch.wast +++ b/test/core/try_catch.wast @@ -147,6 +147,16 @@ (catch $e0 (i32.const 1)) ) ) + + (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)) + ) ) (assert_return (invoke "empty-catch")) @@ -188,6 +198,10 @@ (assert_return (invoke "catchless-try" (i32.const 0)) (i32.const 0)) (assert_return (invoke "catchless-try" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "break-try-catch")) +(assert_return (invoke "break-try-catch_all")) + + (module (func $imported-throw (import "test" "throw")) (tag $e0) diff --git a/test/core/try_delegate.wast b/test/core/try_delegate.wast index 8ee864eb..08a3075c 100644 --- a/test/core/try_delegate.wast +++ b/test/core/try_delegate.wast @@ -115,6 +115,48 @@ (delegate $l3)))) unreachable) (catch_all (i32.const 1)))) + + (func $throw (throw $e0)) + + (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 "delegate-no-throw") (i32.const 1)) @@ -140,6 +182,11 @@ (assert_return (invoke "delegate-correct-targets") (i32.const 1)) +(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)) + (assert_malformed (module quote "(module (func (delegate 0)))") "unexpected token"