-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
error instead of panic on wit parse failures
- Loading branch information
Chris Nelson
committed
Dec 17, 2024
1 parent
277ab71
commit c248d38
Showing
4 changed files
with
20 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
defmodule Components.WitParserTest do | ||
use ExUnit.Case | ||
|
||
test "exported_functions" do | ||
wit = File.read!("test/component_fixtures/hello_world/hello-world.wit") | ||
describe "exports" do | ||
test "exported_functions" do | ||
wit = File.read!("test/component_fixtures/hello_world/hello-world.wit") | ||
|
||
assert %{"greet" => 1, "greet-many" => 1, "multi-greet" => 2} = | ||
Wasmex.Native.wit_exported_functions("hello-world.wit", wit) | ||
assert %{"greet" => 1, "greet-many" => 1, "multi-greet" => 2} = | ||
Wasmex.Native.wit_exported_functions("hello-world.wit", wit) | ||
end | ||
|
||
test "wit parse errors" do | ||
wit = "goo goo" | ||
assert {:error, error} = Wasmex.Native.wit_exported_functions("hello-world.wit", wit) | ||
assert error =~ "Failed to parse WIT" | ||
end | ||
end | ||
|
||
end |