Skip to content

Commit

Permalink
Add file path in case it cannot be read in Diff::actual_file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 27, 2024
1 parent 90fec5a commit 1551fd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tools/run-make-support/src/diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ impl Diff {
/// Specify the actual output for the diff from a file.
pub fn actual_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
let path = path.as_ref();
let content = std::fs::read_to_string(path).expect("failed to read file");
let content = match std::fs::read_to_string(path) {
Ok(c) => c,
Err(e) => panic!("failed to read `{}`: {:?}", path.display(), e),
};
let name = path.to_string_lossy().to_string();

self.actual = Some(content);
Expand Down

0 comments on commit 1551fd1

Please sign in to comment.