Improve the format of error messages for failing examples.
- Compiler error messages are usually formatted as follows: PROGRAM:FILE_NAME:LINENO: MESSAGE - When an example fails, format it accordingly. - This has the advantage that IDEs like emacs can jump to the specified location.
This commit is contained in:
parent
10cb342612
commit
f419837b31
@ -195,7 +195,7 @@ macro_rules! test_examples {
|
||||
|
||||
eprintln!("Testing example from {}:{}", file!(), line!());
|
||||
|
||||
for action in $actions.actions {
|
||||
for (i, action) in $actions.actions.into_iter().enumerate() {
|
||||
let command = if let Some(command) = action.command() {
|
||||
command
|
||||
} else {
|
||||
@ -222,7 +222,11 @@ macro_rules! test_examples {
|
||||
|
||||
let res = cmd.assert();
|
||||
intermediate = Some(res.get_output().stdout.clone());
|
||||
res.success();
|
||||
if let Err(err) = res.try_success() {
|
||||
eprintln!("example:{}:{}: executing example #{}: {}",
|
||||
file!(), line!(), i + 1, err);
|
||||
panic!("executing example failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user