Skip to content

Commit

Permalink
Split off into try-br-interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
SoniEx2 committed Apr 22, 2023
1 parent 625358d commit 9e9756e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 22 deletions.
65 changes: 65 additions & 0 deletions test/core/try-br-interactions.wast
Original file line number Diff line number Diff line change
@@ -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))
22 changes: 0 additions & 22 deletions test/core/try_delegate.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"
Expand Down

0 comments on commit 9e9756e

Please sign in to comment.