Merge pull request #1481 from regexident/system-error
Improve error message for missing source/target test file
This commit is contained in:
commit
674d15e057
@ -332,10 +332,12 @@ fn handle_result(result: HashMap<String, String>,
|
||||
for (file_name, fmt_text) in result {
|
||||
// If file is in tests/source, compare to file with same name in tests/target.
|
||||
let target = get_target(&file_name, target);
|
||||
let mut f = fs::File::open(&target).expect("Couldn't open target");
|
||||
let open_error = format!("Couldn't open target {:?}", &target);
|
||||
let mut f = fs::File::open(&target).expect(&open_error);
|
||||
|
||||
let mut text = String::new();
|
||||
f.read_to_string(&mut text).expect("Failed reading target");
|
||||
let read_error = format!("Failed reading target {:?}", &target);
|
||||
f.read_to_string(&mut text).expect(&read_error);
|
||||
|
||||
if fmt_text != text {
|
||||
let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user