I thought this would've been enough:
<project>/tests/integration.rs
:
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd"
))]
mod unix;
#[cfg(windows)]
mod windows;
But cargo test
always compiles all of them regardless of the cfg
.
kornel
2
Cargo compiles tests/*.rs
, so put them in a folder (use mod folder { mod unix; }
).
Alternatively, use #![cfg()]
at the top of each file.
1 Like
Thanks for the response, I have already figured out and used the #![cfg()]
solution. Thanks for confirming it
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.