Skip to content

Commit

Permalink
more robust subdir_ffi tests
Browse files Browse the repository at this point in the history
- Test header file in separate subdir
- Test parent folder ffi in Erlang
  • Loading branch information
PgBiel committed Sep 15, 2024
1 parent 31f4ef2 commit a7903ba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/subdir_ffi/src/nested/submodule.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub fn submodule_main() {
parent_println(elixir_message())
}

@external(erlang, "erlang", "display")
@external(erlang, "project_ffi", "log")
@external(javascript, "../project_ffi.mjs", "log")
fn parent_println(a: String) -> Nil

Expand Down
2 changes: 1 addition & 1 deletion test/subdir_ffi/src/nested/submodule_ffi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

-export([main/0, main2/0]).

-include("submodule_ffi_header.hrl").
-include("../headers/submodule_ffi_header.hrl").

main() ->
String = header_function(),
Expand Down
2 changes: 1 addition & 1 deletion test/subdir_ffi/src/project.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn main() {
println(subdir_elixir_message())
}

@external(erlang, "erlang", "display")
@external(erlang, "project_ffi", "log")
@external(javascript, "./project_ffi.mjs", "log")
fn println(a: String) -> Nil

Expand Down
6 changes: 6 additions & 0 deletions test/subdir_ffi/src/project_ffi.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-module(project_ffi).

-export([log/1]).

log(Message) ->
erlang:display(Message).

0 comments on commit a7903ba

Please sign in to comment.