# 所有测试
cargo test --workspace
# 特定包
cargo test -p content
cargo test -p server
# 特定测试
cargo test test_content_loading
#![allow(unused)]
fn main() {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_example() {
let result = my_function(42);
assert!(result.is_ok());
}
}
}
#![allow(unused)]
fn main() {
// tests/integration_test.rs
use my_crate::*;
#[test]
fn test_full_flow() {
let runtime = Runtime::new();
runtime.initialize(config).unwrap();
// ...
}
}
cargo install cargo-tarpaulin
cargo tarpaulin --workspace