I think we can trim the testing code with a macro for calling the bif function.
During my development, the following codes were repeatedly entered.
let vm = vm::Machine::new();
let module: *const module::Module = std::ptr::null();
let process = process::allocate(&vm.state, module).wrap();
let args = vec![xxxxxxx];
let res = bif_the_function_I_want_to_test(&vm, &process, &args);
Most of the codes are not used for testing. The code duplication is so high that I think it can be replaced by a macro as a high order function like the following one.
macro_rules! test_it(func: func ; $($arg: expr), *) => {
// The code as the above
}
I can do this in Elixir but not sure if it is valid in Rust.
Does it sound a valid solution to you? @archseer
If it is okay, I will do it and refactor the unit tests.
I think we can trim the testing code with a macro for calling the bif function.
During my development, the following codes were repeatedly entered.
Most of the codes are not used for testing. The code duplication is so high that I think it can be replaced by a macro as a high order function like the following one.
I can do this in Elixir but not sure if it is valid in Rust.
Does it sound a valid solution to you? @archseer
If it is okay, I will do it and refactor the unit tests.