I am cross-compiling to wasm32-unknown-unknown
and I would like to create a test for our CI. The problem is I can't find a standard way to identify the host_os
and I tried to pass a --cfg
to cargo test but it also doesn't seem possible.
I would be glad if someone point me to a documentation or maybe a workaround.
Here is the code I am trying to implement:
#[cfg(test)]
mod test {
use super::Platform;
use wasm_bindgen_test::wasm_bindgen_test;
use wasm_bindgen_test::wasm_bindgen_test_configure;
wasm_bindgen_test_configure!(run_in_browser);
fn host_platform() -> Platform {
#[cfg(host_os = "linux")]
Platform::Linux
}
#[wasm_bindgen_test]
fn platform() {
assert_eq!(Platform::query(), host_platform())
}
}