Add file path in case it cannot be read in Diff::actual_file
This commit is contained in:
parent
90fec5a087
commit
1551fd1202
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user