Skip to content

Commit 74c1ef6

Browse files
authored
Add test for resume_throw in the initial execution (#123)
1 parent 3c7c0cb commit 74c1ef6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/core/stack-switching/cont.wast

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,33 @@
235235
(type $c2 (cont $f2))
236236
)
237237

238+
;; Test resume_throw used on the very first execution of a continuation (so the
239+
;; code in the continuation function is never reached).
240+
(module
241+
(tag $exn)
242+
243+
(type $f (func))
244+
(type $k (cont $f))
245+
246+
(func $never
247+
(unreachable)
248+
)
249+
250+
(func (export "resume_throw-never")
251+
(block $handle
252+
(try_table (catch $exn $handle)
253+
(resume_throw $k $exn
254+
(cont.new $k (ref.func $never))
255+
)
256+
)
257+
)
258+
)
259+
260+
(elem declare func $never)
261+
)
262+
263+
(assert_return (invoke "resume_throw-never"))
264+
238265
;; Simple state example
239266

240267
(module $state

0 commit comments

Comments
 (0)