Skip to content

Commit

Permalink
Test global ref types err
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalIcing committed Apr 5, 2024
1 parent 3eac8b8 commit b1cf190
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/example_wasm_files/globals.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
(global $meaning_of_life (export "meaning_of_life") i32 (i32.const 42))
(global (export "count_32") (mut i32) (i32.const -32))
(global (export "count_64") (mut i64) (i64.const -64))
(global (export "externref") externref (ref.null extern))
(global (export "funcref") funcref (ref.null func))
(global (export "bad_pi_32") (mut f32) (f32.const 0))
(global (export "bad_pi_64") (mut f64) (f64.const 0))
)
6 changes: 6 additions & 0 deletions test/wasmex/instance_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ defmodule Wasmex.InstanceTest do
assert {:ok, 42} = Wasmex.Instance.get_global_value(store, instance, "meaning_of_life")
assert {:ok, -32} = Wasmex.Instance.get_global_value(store, instance, "count_32")
assert {:ok, -64} = Wasmex.Instance.get_global_value(store, instance, "count_64")

assert {:error, "unable_to_return_extern_ref_type"} =
Wasmex.Instance.get_global_value(store, instance, "externref")

assert {:error, "unable_to_return_func_ref_type"} =
Wasmex.Instance.get_global_value(store, instance, "funcref")
end

test t(&Wasmex.Instance.set_global_value/4), context do
Expand Down

0 comments on commit b1cf190

Please sign in to comment.