Debian Codegraph @

third_party/rust/id-arena/tests/readme_up_to_date.rs

raw
1 use std::fs;
2 use std::process::Command;
3
4 #[test]
5 fn cargo_readme_up_to_date() {
6 println!("Checking that `cargo readme > README.md` is up to date...");
7
8 let expected = Command::new("cargo")
9 .arg("readme")
10 .current_dir(env!("CARGO_MANIFEST_DIR"))
11 .output()
12 .expect("should run `cargo readme` OK")
13 .stdout;
14 let expected = String::from_utf8_lossy(&expected);
15
16 let actual = fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))
17 .expect("should read README.md OK");
18
19 if actual != expected {
20 panic!("Run `cargo readme > README.md` to update README.md");
21 }
22 }