Skip to content

Commit

Permalink
Add Roundtrip Tests for both instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
CryZe committed Sep 9, 2024
1 parent 213baa9 commit c5fb325
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/tests/tests/round_trip/return_call.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(module
(func $g (result i32)
i32.const 42
return)
(func $f (result i32)
return_call $g)
(export "f" (func $f)))

(; CHECK-ALL:
(module
(type (;0;) (func (result i32)))
(func $g (;0;) (type 0) (result i32)
i32.const 42
return
)
(func $f (;1;) (type 0) (result i32)
return_call $g
)
(export "f" (func $f))
;)
18 changes: 18 additions & 0 deletions crates/tests/tests/round_trip/return_call_indirect.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(module
(type (func (result i32)))
(table 1 funcref)
(func (export "a") (param i32) (result i32)
local.get 0
return_call_indirect (type 0)))

(; CHECK-ALL:
(module
(type (;0;) (func (result i32)))
(type (;1;) (func (param i32) (result i32)))
(func (;0;) (type 1) (param i32) (result i32)
local.get 0
return_call_indirect (type 0)
)
(table (;0;) 1 funcref)
(export "a" (func 0))
;)

0 comments on commit c5fb325

Please sign in to comment.