It would be nice to be able to have the test framework / runner not coupled to the core language or compiler, so Gleam users can opt to use a test framework or runner of their chosing. We may need to have some functionality in the compiler for the discovery of tests though.
lpil Today at 13:45
There's no way to [find the test functions from the compiled code at runtime] in a type safe fashion, which is why I think having function discovery be done by the compiler is important for the future
We could have an interface like this
pub type Test {
Test(name: String, sync: Bool, run: fn() -> TestOutcome)
};
pub type TestModule {
TestModule(name: String, tests: List(Test))
};
pub type TestFramework = fn(List(TestModule)) -> Nil
> And then you tell the Gleam where to find your TestFramework and it generates a main function with everything hooked up
> And all the unsafe bits are handled by the compiler
A test framework for Gleam (and also Erlang).
It would be nice to be able to have the test framework / runner not coupled to the core language or compiler, so Gleam users can opt to use a test framework or runner of their chosing. We may need to have some functionality in the compiler for the discovery of tests though.
pub type TestModule { TestModule(name: String, tests: List(Test)) };
pub type TestFramework = fn(List(TestModule)) -> Nil