Skip to content

Commit

Permalink
print revision in a consistent way
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 26, 2023
1 parent 602772a commit a9ee76a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
9 changes: 3 additions & 6 deletions src/status_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ struct TextTest {
}

impl TextTest {
/// Prints the user-visible name for this test.
fn msg(&self) -> String {
if self.revision.is_empty() {
self.path.display().to_string()
} else {
format!("{} ({})", self.path.display(), self.revision)
format!("{} (revision `{}`)", self.path.display(), self.revision)
}
}
}
Expand Down Expand Up @@ -243,11 +244,7 @@ impl TestStatus for TextTest {
stderr: &'a [u8],
stdout: &'a [u8],
) -> Box<dyn Debug + 'a> {
let mut path = self.path.display().to_string();
if !self.revision.is_empty() {
write!(path, " (revision `{}`)", self.revision).unwrap();
}
let text = format!("{} {path}", "FAILED TEST:".bright_red());
let text = format!("{} {}", "FAILED TEST:".bright_red(), self.msg());

println!();
println!("{}", text.bold().underline());
Expand Down
40 changes: 20 additions & 20 deletions tests/integrations/basic-fail/Cargo.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -307,25 +307,25 @@ tests/actual_tests_bless/non_top_level_configs.rs ... FAILED
tests/actual_tests_bless/pass.rs ... ok
tests/actual_tests_bless/pass_with_annotation.rs ... FAILED
tests/actual_tests_bless/revised_revision.rs ... FAILED
tests/actual_tests_bless/revisioned_executable.rs (run) ... ok
tests/actual_tests_bless/revisioned_executable.rs (panic) ... FAILED
tests/actual_tests_bless/revisioned_executable_panic.rs (run) ... FAILED
tests/actual_tests_bless/revisioned_executable_panic.rs (panic) ... ok
tests/actual_tests_bless/revisions.rs (foo) ... ok
tests/actual_tests_bless/revisions.rs (bar) ... ok
tests/actual_tests_bless/revisions_bad.rs (foo) ... ok
tests/actual_tests_bless/revisions_bad.rs (bar) ... FAILED
tests/actual_tests_bless/revisions_filter.rs (foo) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter.rs (bar) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter2.rs (foo) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter2.rs (bar) ... ok
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (foo) ... ok
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (bar) ... ok
tests/actual_tests_bless/revisions_same_everywhere.rs (foo) ... ok
tests/actual_tests_bless/revisions_same_everywhere.rs (bar) ... ok
tests/actual_tests_bless/revisioned_executable.rs (revision `run`) ... ok
tests/actual_tests_bless/revisioned_executable.rs (revision `panic`) ... FAILED
tests/actual_tests_bless/revisioned_executable_panic.rs (revision `run`) ... FAILED
tests/actual_tests_bless/revisioned_executable_panic.rs (revision `panic`) ... ok
tests/actual_tests_bless/revisions.rs (revision `foo`) ... ok
tests/actual_tests_bless/revisions.rs (revision `bar`) ... ok
tests/actual_tests_bless/revisions_bad.rs (revision `foo`) ... ok
tests/actual_tests_bless/revisions_bad.rs (revision `bar`) ... FAILED
tests/actual_tests_bless/revisions_filter.rs (revision `foo`) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter.rs (revision `bar`) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter2.rs (revision `foo`) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter2.rs (revision `bar`) ... ok
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (revision `foo`) ... ok
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (revision `bar`) ... ok
tests/actual_tests_bless/revisions_same_everywhere.rs (revision `foo`) ... ok
tests/actual_tests_bless/revisions_same_everywhere.rs (revision `bar`) ... ok
tests/actual_tests_bless/run_panic.rs ... ok
tests/actual_tests_bless/rustfix-fail-revisions.rs (a) ... FAILED
tests/actual_tests_bless/rustfix-fail-revisions.rs (b) ... FAILED
tests/actual_tests_bless/rustfix-fail-revisions.rs (revision `a`) ... FAILED
tests/actual_tests_bless/rustfix-fail-revisions.rs (revision `b`) ... FAILED
tests/actual_tests_bless/rustfix-fail.rs ... FAILED
tests/actual_tests_bless/unknown_revision.rs ... FAILED
tests/actual_tests_bless/unknown_revision2.rs ... FAILED
Expand Down Expand Up @@ -780,8 +780,8 @@ FAILURES:
test result: FAIL. 20 failed; 14 passed; 3 ignored;

Building dependencies ... ok
tests/actual_tests_bless_yolo/revisions_bad.rs (foo) ... ok
tests/actual_tests_bless_yolo/revisions_bad.rs (bar) ... FAILED
tests/actual_tests_bless_yolo/revisions_bad.rs (revision `foo`) ... ok
tests/actual_tests_bless_yolo/revisions_bad.rs (revision `bar`) ... FAILED
tests/actual_tests_bless_yolo/rustfix-maybe-incorrect.rs ... ok

FAILED TEST: tests/actual_tests_bless_yolo/revisions_bad.rs (revision `bar`)
Expand Down

0 comments on commit a9ee76a

Please sign in to comment.