October 2019
Intermediate to advanced
444 pages
10h 37m
English
To explore cargo testing capabilities, follow these steps:
#[cfg(test)]mod tests { use std::thread::sleep; use std::time::Duration; #[test] fn it_works() { assert_eq!(2 + 2, 4); } #[test] fn wait_10secs() { sleep(Duration::from_secs(10)); println!("Waited for 10 seconds"); assert_eq!(2 + 2, 4); } #[test] fn wait_5secs() { sleep(Duration::from_secs(5)); println!("Waited for 5 seconds"); assert_eq!(2 + 2, 4); } #[test] #[ignore] fn ignored() { assert_eq!(2 + 2, 4); }}
Read now
Unlock full access