Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

add subdir_ffi integration tests

+142
+1
Makefile
··· 25 25 cd test/project_deno && cargo run clean && cargo run check && cargo run test 26 26 cd test/hextarball && make test 27 27 cd test/running_modules && make test 28 + cd test/subdir_ffi && make 28 29 29 30 .PHONY: language-test 30 31 language-test: ## Run the language integration tests for all targets
+4
test/subdir_ffi/.gitignore
··· 1 + *.beam 2 + *.ez 3 + build 4 + erl_crash.dump
+26
test/subdir_ffi/Makefile
··· 1 + .phony: build 2 + build: clean erlang nodejs deno bun 3 + 4 + .phony: clean 5 + clean: 6 + rm -rf build 7 + 8 + .phony: erlang 9 + erlang: 10 + @echo test/subdir_ffi on Erlang 11 + cargo run --quiet -- test --target erlang 12 + 13 + .phony: nodejs 14 + nodejs: 15 + @echo test/subdir_ffi on JavaScript with Node 16 + cargo run --quiet -- test --target javascript --runtime nodejs 17 + 18 + .phony: deno 19 + deno: 20 + @echo test/subdir_ffi on JavaScript with Deno 21 + cargo run --quiet -- test --target javascript --runtime deno 22 + 23 + .phony: bun 24 + bun: 25 + @echo test/subdir_ffi on JavaScript with Bun 26 + cargo run --quiet -- test --target javascript --runtime bun
+4
test/subdir_ffi/README.md
··· 1 + # subdir_ffi 2 + 3 + This package is used to check if the compiler properly supports FFI files (such 4 + as `.mjs`, `.erl` and `.hrl`) in subdirectories.
+19
test/subdir_ffi/gleam.toml
··· 1 + name = "subdir_ffi" 2 + version = "1.0.0" 3 + 4 + # Fill out these fields if you intend to generate HTML documentation or publish 5 + # your project to the Hex package manager. 6 + # 7 + # description = "" 8 + # licences = ["Apache-2.0"] 9 + # repository = { type = "github", user = "", repo = "" } 10 + # links = [{ title = "Website", href = "" }] 11 + # 12 + # For a full reference of all the available options, you can have a look at 13 + # https://gleam.run/writing-gleam/gleam-toml/. 14 + 15 + [dependencies] 16 + gleam_stdlib = ">= 0.34.0 and < 2.0.0" 17 + 18 + [dev-dependencies] 19 + gleeunit = ">= 1.0.0 and < 2.0.0"
+11
test/subdir_ffi/manifest.toml
··· 1 + # This file was generated by Gleam 2 + # You typically do not need to edit this file 3 + 4 + packages = [ 5 + { name = "gleam_stdlib", version = "0.40.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86606B75A600BBD05E539EB59FABC6E307EEEA7B1E5865AFB6D980A93BCB2181" }, 6 + { name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" }, 7 + ] 8 + 9 + [requirements] 10 + gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" } 11 + gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+16
test/subdir_ffi/src/nested/submodule.gleam
··· 1 + pub fn submodule_main() { 2 + parent_println(message()) 3 + parent_println(elixir_message()) 4 + } 5 + 6 + @external(erlang, "erlang", "display") 7 + @external(javascript, "../project_ffi.mjs", "log") 8 + fn parent_println(a: String) -> Nil 9 + 10 + @external(erlang, "submodule_ffi", "main") 11 + @external(javascript, "./submodule_ffi.mjs", "main") 12 + fn message() -> String 13 + 14 + @external(erlang, "Elixir.ElixirFile", "main") 15 + @external(javascript, "./submodule_ffi.mjs", "main") 16 + fn elixir_message() -> String
+13
test/subdir_ffi/src/nested/submodule_ffi.erl
··· 1 + -module(submodule_ffi). 2 + 3 + -export([main/0, main2/0]). 4 + 5 + -include("submodule_ffi_header.hrl"). 6 + 7 + main() -> 8 + String = header_function(), 9 + <<"Hello, from the nested Erlang module!\n"/utf8, String/binary>>. 10 + 11 + main2() -> 12 + String = header_function(), 13 + <<"Hello again, from the nested Erlang module!\n"/utf8, String/binary>>.
+11
test/subdir_ffi/src/nested/submodule_ffi.ex
··· 1 + defmodule ElixirFile do 2 + def main() do 3 + "Hello, from the Elixir module!" 4 + end 5 + end 6 + 7 + defmodule ElixirFileAgain do 8 + def main() do 9 + "Hello, from another Elixir module!" 10 + end 11 + end
+7
test/subdir_ffi/src/nested/submodule_ffi.mjs
··· 1 + export function main(x) { 2 + return "Hello from the nested JavaScript native module!"; 3 + } 4 + 5 + export function main2(x) { 6 + return "Hello again from the nested JavaScript native module!"; 7 + }
+2
test/subdir_ffi/src/nested/submodule_ffi_header.hrl
··· 1 + header_function() -> 2 + <<"Hello, from the nested Erlang header!">>.
+20
test/subdir_ffi/src/project.gleam
··· 1 + import nested/submodule 2 + 3 + pub fn main() { 4 + println("Hello from subdir_ffi!") 5 + submodule.submodule_main() 6 + println(subdir_message()) 7 + println(subdir_elixir_message()) 8 + } 9 + 10 + @external(erlang, "erlang", "display") 11 + @external(javascript, "./project_ffi.mjs", "log") 12 + fn println(a: String) -> Nil 13 + 14 + @external(erlang, "submodule_ffi", "main2") 15 + @external(javascript, "./nested/submodule_ffi.mjs", "main2") 16 + fn subdir_message() -> String 17 + 18 + @external(erlang, "Elixir.ElixirFileAgain", "main") 19 + @external(javascript, "./nested/submodule_ffi.mjs", "main2") 20 + fn subdir_elixir_message() -> String
+3
test/subdir_ffi/src/project_ffi.mjs
··· 1 + export function log(x) { 2 + console.log(x); 3 + }
+5
test/subdir_ffi/test/subdir_ffi_test.gleam
··· 1 + import project 2 + 3 + pub fn main() { 4 + project.main() 5 + }