Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
quickchecks.rs | H A D | 03-Jan-2020 | 6.4 KiB | 196 | 162 | |
readme.rs | H A D | 03-Jan-2020 | 846 | 30 | 25 | |
serde.rs | H A D | 03-Jan-2020 | 5.5 KiB | 177 | 154 | |
tests.rs | H A D | 18-May-2020 | 7.6 KiB | 296 | 252 |
readme.rs
1 use std::fs::File; 2 use std::io::Read; 3 use std::process::Command; 4 5 #[test] cargo_readme_up_to_date()6fn cargo_readme_up_to_date() { 7 println!("Checking that `cargo readme > README.md` is up to date..."); 8 9 let expected = Command::new("cargo") 10 .arg("readme") 11 .current_dir(env!("CARGO_MANIFEST_DIR")) 12 .output() 13 .expect("should run `cargo readme` OK") 14 .stdout; 15 let expected = String::from_utf8_lossy(&expected); 16 17 let actual = { 18 let mut file = File::open(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md")) 19 .expect("should open README.md file"); 20 let mut s = String::new(); 21 file.read_to_string(&mut s) 22 .expect("should read contents of file to string"); 23 s 24 }; 25 26 if actual != expected { 27 panic!("Run `cargo readme > README.md` to update README.md"); 28 } 29 } 30