• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

quickchecks.rsH A D03-Jan-20206.4 KiB196162

readme.rsH A D03-Jan-2020846 3025

serde.rsH A D03-Jan-20205.5 KiB177154

tests.rsH A D18-May-20207.6 KiB296252

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()6 fn 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