From a7903ba0e994352461590b6cce5d0524b6df9d5e Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Sun, 15 Sep 2024 14:26:26 -0300 Subject: [PATCH] more robust subdir_ffi tests - Test header file in separate subdir - Test parent folder ffi in Erlang --- .../src/{nested => headers}/submodule_ffi_header.hrl | 0 test/subdir_ffi/src/nested/submodule.gleam | 2 +- test/subdir_ffi/src/nested/submodule_ffi.erl | 2 +- test/subdir_ffi/src/project.gleam | 2 +- test/subdir_ffi/src/project_ffi.erl | 6 ++++++ 5 files changed, 9 insertions(+), 3 deletions(-) rename test/subdir_ffi/src/{nested => headers}/submodule_ffi_header.hrl (100%) create mode 100644 test/subdir_ffi/src/project_ffi.erl diff --git a/test/subdir_ffi/src/nested/submodule_ffi_header.hrl b/test/subdir_ffi/src/headers/submodule_ffi_header.hrl similarity index 100% rename from test/subdir_ffi/src/nested/submodule_ffi_header.hrl rename to test/subdir_ffi/src/headers/submodule_ffi_header.hrl diff --git a/test/subdir_ffi/src/nested/submodule.gleam b/test/subdir_ffi/src/nested/submodule.gleam index c002e715d53..9d663bb5747 100644 --- a/test/subdir_ffi/src/nested/submodule.gleam +++ b/test/subdir_ffi/src/nested/submodule.gleam @@ -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 diff --git a/test/subdir_ffi/src/nested/submodule_ffi.erl b/test/subdir_ffi/src/nested/submodule_ffi.erl index bca788dd095..ea1c0b91841 100644 --- a/test/subdir_ffi/src/nested/submodule_ffi.erl +++ b/test/subdir_ffi/src/nested/submodule_ffi.erl @@ -2,7 +2,7 @@ -export([main/0, main2/0]). --include("submodule_ffi_header.hrl"). +-include("../headers/submodule_ffi_header.hrl"). main() -> String = header_function(), diff --git a/test/subdir_ffi/src/project.gleam b/test/subdir_ffi/src/project.gleam index 9130e36c5d9..b126e234c4e 100644 --- a/test/subdir_ffi/src/project.gleam +++ b/test/subdir_ffi/src/project.gleam @@ -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 diff --git a/test/subdir_ffi/src/project_ffi.erl b/test/subdir_ffi/src/project_ffi.erl new file mode 100644 index 00000000000..fde3c3de650 --- /dev/null +++ b/test/subdir_ffi/src/project_ffi.erl @@ -0,0 +1,6 @@ +-module(project_ffi). + +-export([log/1]). + +log(Message) -> + erlang:display(Message).