#[cfg(test)] mod tests { use std::thread; use std::time::Duration; #[test] fn quick_test() { assert_eq!(2 + 2, 4); } #[test] #[ignore] fn slow_test() { // Simulate a long-running test thread::sleep(Duration::from_secs(5)); assert!(true); } }
🧪 #Rustlang Tip: Use #[test] with #[ignore] for long-running or resource-intensive tests.
Run all tests: cargo test
Run ignored tests: cargo test -- --ignored
This helps keep your test suite fast while still allowing those long running tests when needed!
#RustTesting #Rust30by30 #Day15