You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo new reproducer && cd reproducer && cargo add --dev rstest
main.rs
fn main() {
println!("Hello, world!");
}
#[cfg(test)]
mod test {
use rstest::rstest;
use std::path::PathBuf;
#[rstest]
fn wrong_testname(#[files("src/main.rs")] _p: PathBuf) {}
}
Run this test on Linux & Windows. Compare names of the generated test cases.
Expected output
cargo test
running 1 test
test test::wrong_testname::_p_1_src_main_rs ... ok
This is what happens when running on Linux.
Actual output
However, when running on Windows 11, this happens:
cargo test
running 1 test
test test::wrong_testname::_p_1__UP_D_Rust_projectsreproducersrcmain_rs ... ok
The test seems to use the full path up from the drive's root, not from the crate's base directory. It is also missing some _ in place of path separators.
The text was updated successfully, but these errors were encountered:
GermanCoding
changed the title
#[files] produces invalid test names on Windows
#[files] produces incorrect test names on Windows
Nov 26, 2024
Steps to reproduce
cargo new reproducer && cd reproducer && cargo add --dev rstest
main.rs
Expected output
cargo test
This is what happens when running on Linux.
Actual output
However, when running on Windows 11, this happens:
cargo test
The test seems to use the full path up from the drive's root, not from the crate's base directory. It is also missing some _ in place of path separators.
The text was updated successfully, but these errors were encountered: