Skip to content

Commit 1858d32

Browse files
committed
Add an extra whitespace between subsequent non-fatal failure messages.
Previously, subsequent non-fatal failure messages had no intervening whitespace, leading them to be visually hard to separate: Value of: value Expected: is equal to 3 Actual: 2, which isn't equal to 3 at .*integration_tests/src/two_expect_that_failures.rs:[0-9]+:9 Value of: value Expected: is equal to 4 Actual: 2, which isn't equal to 4 at .*integration_tests/src/two_expect_that_failures.rs:[0-9]+:9 This modifies the `TestAssertionFailure::log` method to output an extra newline after a non-fatal failure message, making the individual failures easier to read: Value of: value Expected: is equal to 3 Actual: 2, which isn't equal to 3 at .*integration_tests/src/two_expect_that_failures.rs:[0-9]+:9 Value of: value Expected: is equal to 4 Actual: 2, which isn't equal to 4 at .*integration_tests/src/two_expect_that_failures.rs:[0-9]+:9
1 parent 6b529d5 commit 1858d32

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

googletest/src/internal/test_outcome.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl TestAssertionFailure {
174174

175175
pub(crate) fn log(&self) {
176176
TestOutcome::fail_current_test();
177-
print!("{}", self);
177+
println!("{}", self);
178178
}
179179
}
180180

integration_tests/src/integration_tests.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,18 @@ mod tests {
137137
}
138138

139139
#[test]
140-
fn should_output_second_failure_message_on_second_assertion_failure_with_expect_that()
141-
-> Result<()> {
140+
fn should_output_both_failure_messages_when_two_expect_that_assertions_fail() -> Result<()> {
142141
let output = run_external_process_in_tests_directory("two_expect_that_failures")?;
143142

144143
verify_that!(
145144
output,
146145
contains_regex(indoc! {"
146+
Value of: value
147+
Expected: is equal to 3
148+
Actual: 2,
149+
which isn't equal to 3
150+
at .*integration_tests/src/two_expect_that_failures.rs:[0-9]+:9
151+
147152
Value of: value
148153
Expected: is equal to 4
149154
Actual: 2,

0 commit comments

Comments
 (0)