Skip to content

Commit

Permalink
Refacto error_string in order to support diff messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricereix committed Apr 2, 2024
1 parent 0aef995 commit cb41092
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 96 deletions.
4 changes: 2 additions & 2 deletions integration/hurl/tests_failed/assert_newline.err
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ error: Assert body value
| ...
10 | <p>Hello</p>
| ^ actual value is <<p>Hello</p>

>
|
| >
|

10 changes: 9 additions & 1 deletion packages/hurl/src/runner/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl hurl_core::error::Error for Error {
} else {
""
};
format!("actual: {actual}\nexpected: {expected}{additional}")
format!(" actual: {actual}\n expected: {expected}{additional}")
}
RunnerError::AssertHeaderValueError { actual } => {
format!("actual value is <{actual}>")
Expand Down Expand Up @@ -257,6 +257,14 @@ impl hurl_core::error::Error for Error {
}
}
}

fn show_source_line(&self) -> bool {
true
}

fn show_caret(&self) -> bool {
!matches!(&self.inner, RunnerError::AssertFailure { .. })
}
}

impl From<HttpError> for RunnerError {
Expand Down
Loading

0 comments on commit cb41092

Please sign in to comment.