Skip to content

Commit

Permalink
fix some warnings and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nelson committed Nov 30, 2024
1 parent 44e830f commit 4acd201
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 0 additions & 3 deletions test/components/component_test.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
defmodule Wasmex.WasmComponentsTest do
use ExUnit.Case, async: true

alias Wasmex.Engine
alias Wasmex.EngineConfig

test "invoke component func" do
{:ok, store} = Wasmex.Components.Store.new_wasi()
component_bytes = File.read!("test/component_fixtures/hello_world/hello_world.wasm")
Expand Down
9 changes: 4 additions & 5 deletions test/components/component_types_test.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
defmodule Wasm.Components.ComponentTypesTest do
use ExUnit.Case, async: true

alias Wasmex.Engine
alias Wasmex.EngineConfig

setup do
{:ok, store} = Wasmex.Components.Store.new()
component_bytes = File.read!("test/component_fixtures/component_types/component_types.wasm")
Expand All @@ -29,8 +26,10 @@ defmodule Wasm.Components.ComponentTypesTest do

test "floats", %{instance: instance} do
pi = 3.14592
assert {:ok, pi} = Wasmex.Components.Instance.call_function(instance, "id-f32", [pi])
assert {:ok, pi} = Wasmex.Components.Instance.call_function(instance, "id-f64", [pi])
assert {:ok, pi_result} = Wasmex.Components.Instance.call_function(instance, "id-f32", [pi])
assert_in_delta(pi, pi_result, 1.0e-5)
assert {:ok, pi_result} = Wasmex.Components.Instance.call_function(instance, "id-f64", [pi])
assert_in_delta(pi, pi_result, 1.0e-5)
end

test "records", %{instance: instance} do
Expand Down
5 changes: 2 additions & 3 deletions test/components/components_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Wasmex.ComponentsTest do
component_bytes = File.read!("test/component_fixtures/component_types/component_types.wasm")
component_pid = start_supervised!({Wasmex.Components, %{bytes: component_bytes}})
assert {:ok, "mom"} = Wasmex.Components.call_function(component_pid, "id-string", ["mom"])
assert {:error, error} = Wasmex.Components.call_function(component_pid, "garbage", ["wut"])
assert {:error, _error} = Wasmex.Components.call_function(component_pid, "garbage", ["wut"])
end

test "wasi interaction" do
Expand All @@ -17,8 +17,7 @@ defmodule Wasmex.ComponentsTest do
{Wasmex.Components, %{bytes: component_bytes, wasi: %WasiP2Options{allow_http: true}}}
)

assert {:ok, time} =
assert({:ok, time} = Wasmex.Components.call_function(component_pid, "get-time", []))
assert {:ok, time} = Wasmex.Components.call_function(component_pid, "get-time", [])

assert time =~ Date.utc_today() |> Date.to_iso8601()
end
Expand Down
2 changes: 0 additions & 2 deletions test/components/wasi_test.exs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
defmodule Wasmex.Components.WasiTest do
use ExUnit.Case, async: true

alias Wasmex.Engine
alias Wasmex.EngineConfig
alias Wasmex.Wasi.WasiP2Options

test "outbound http call" do
Expand Down

0 comments on commit 4acd201

Please sign in to comment.