Wasmedge support?
Hi @hydai,
It seems test-with goes into your vision.
Do you want to use this crate with wasmedge?
I am happy to add test_with::wasmedge_runer!, if this is suitable for my friend's using case.
Hi @yanganto
Initially, I am just considering whether this crate may help our (WasmEdge) Rust installer1 or Rust SDK2. Since both require some environment variables and may need to check that certain asset-hosted servers exist, it might be helpful for us to apply test-with for these conditions.
However, the test_with::wasmedge_runner sounds interesting. Could you give me some hints or examples so I can get an idea of how this might work? I am not very familiar with this crate at the moment.
wasmedge needs an environment setting, these is a similar thing to set up a mock environment. The overall syntax will like this.
test_with::wasmedge_runner!(mytests);
// The WasmedgeEnv can be provided in wasmedge SDK, or inside `test-with` with feature.
// So a user do not need to write down these every time for a common test scenario.
impl Default for WasmedgeEnv {
fn default() -> Env {
// setup env wasmedge need
Env { ... }
}
}
impl Drop for WasmedgeEnv {
fn drop(&mut self) {
...
}
}
#[test_with::module]
mod mytests {
pub type TestEnv = super::WasmedgeEnv;
#[test_with::runtime_http(127.0.0.1:8000)]
fn testcase1() {
assert!(true);
}
#[test_with::runtime_tcp(193.194.195.196)]
fn testcase2() {
assert!(true);
}
}
This is just a flash though and easier for your users to try something, and also build show case when you demo in every talk. Also CC @juntao
Would you like to create an issue on https://github.com/WasmEdge/wasmedgeup/issues?
This is quite interesting, and maybe I can include this in the next term's LFX mentorship and ask mentees to apply test-with to our testing plan.
Sure, I will be happy to have PRs from your end, and also willing to give a call for mentees need my help to know this crate. 😄