Advertisements
I developed a fairly long build script. Now I need to add a set of unit tests to build.rs file. I tried to do the same as I do for regular files:
// build.rs
#[cfg(test)]
mod tests {
#[test]
fn test1() {
//...
}
}
but seems it didn’t work. Running tests doesn’t result in running test1
.
>Solution :
This is issue #1581, that was closed as "needs an RFC". So this is not possible currently. The workaround, as @MeetTitan said, is to extract the build script logic into its own crate and make it a build-dependency and call it from the build script.