(relative: &str)
| 87 | } |
| 88 | |
| 89 | fn read(relative: &str) -> String { |
| 90 | let contents = fs::read_to_string(manifest_dir().join(relative)) |
| 91 | .unwrap_or_else(|error| panic!("cannot read {relative}: {error}")); |
| 92 | // Windows checkouts may use CRLF; strip the test module on either platform. |
| 93 | let contents = contents.replace("\r\n", "\n"); |
| 94 | contents |
| 95 | .split("\n#[cfg(test)]\nmod tests") |
| 96 | .next() |
| 97 | .unwrap_or(&contents) |
| 98 | .to_string() |
| 99 | } |
| 100 | |
| 101 | fn manifest_dir() -> PathBuf { |
| 102 | Path::new(env!("CARGO_MANIFEST_DIR")).to_path_buf() |
no test coverage detected