Skip to content

Commit

Permalink
Move to existing test files
Browse files Browse the repository at this point in the history
  • Loading branch information
SoniEx2 committed Apr 25, 2023
1 parent 9e9756e commit 9f16cd1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 65 deletions.
65 changes: 0 additions & 65 deletions test/core/try-br-interactions.wast

This file was deleted.

14 changes: 14 additions & 0 deletions test/core/try_catch.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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)
Expand Down
47 changes: 47 additions & 0 deletions test/core/try_delegate.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"
Expand Down

0 comments on commit 9f16cd1

Please sign in to comment.