Skip to content

Commit

Permalink
GC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbourassa committed Apr 23, 2023
1 parent cb6125b commit c7603f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/unit/func_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ module Wasmtime
func.call(1)
expect(called).to be true
end

describe "GC sanity checks" do
it "returns multiple funcrefs" do
funcref = Func.new(store, [], []) {}
func = Func.new(store, [], [:funcref] * 20) { [funcref] * 20 }
5.times { func.call }
end

it "returns multiple externrefs" do
func = Func.new(store, [], [:externref] * 20) { [BasicObject.new] * 20 }
5.times { func.call }
end

it "returns a couple values and an error" do
func = Func.new(store, [], [:i32, :i32, :i32]) { [1, 2, BasicObject.new] }
5.times do
expect { func.call }.to raise_error(Wasmtime::ResultError)
end
end
end
end

describe "Caller" do
Expand Down

0 comments on commit c7603f8

Please sign in to comment.