一个模块包含多个测试,如下所示:
#[cfg(test)]
mod tests_cases {
/*
#[test]
fn test_1() {
let a = 1;
let b = 2;
println!("{},{}", a, b);
assert_ne!(a, b);
}
*/
#[test]
fn test_2() {
let c = 1;
let d = 1;
println!("currently working on this: {},{}", c, d);
assert_eq!(c, d);
}
}
当进行第二个测试并且输出可见时(cargo test -- --nocapture
),我不想看到第一个测试的输出。是否有禁用已注释单元测试的选项?或者是否有只运行第二个单元测试的选项?
cargo test module::tests::test_2
。 - Kendas