Skip to content

Commit a9ee76a

Browse files
committed
print revision in a consistent way
1 parent 602772a commit a9ee76a

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

src/status_emitter.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ struct TextTest {
201201
}
202202

203203
impl TextTest {
204+
/// Prints the user-visible name for this test.
204205
fn msg(&self) -> String {
205206
if self.revision.is_empty() {
206207
self.path.display().to_string()
207208
} else {
208-
format!("{} ({})", self.path.display(), self.revision)
209+
format!("{} (revision `{}`)", self.path.display(), self.revision)
209210
}
210211
}
211212
}
@@ -243,11 +244,7 @@ impl TestStatus for TextTest {
243244
stderr: &'a [u8],
244245
stdout: &'a [u8],
245246
) -> Box<dyn Debug + 'a> {
246-
let mut path = self.path.display().to_string();
247-
if !self.revision.is_empty() {
248-
write!(path, " (revision `{}`)", self.revision).unwrap();
249-
}
250-
let text = format!("{} {path}", "FAILED TEST:".bright_red());
247+
let text = format!("{} {}", "FAILED TEST:".bright_red(), self.msg());
251248

252249
println!();
253250
println!("{}", text.bold().underline());

tests/integrations/basic-fail/Cargo.stdout

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -307,25 +307,25 @@ tests/actual_tests_bless/non_top_level_configs.rs ... FAILED
307307
tests/actual_tests_bless/pass.rs ... ok
308308
tests/actual_tests_bless/pass_with_annotation.rs ... FAILED
309309
tests/actual_tests_bless/revised_revision.rs ... FAILED
310-
tests/actual_tests_bless/revisioned_executable.rs (run) ... ok
311-
tests/actual_tests_bless/revisioned_executable.rs (panic) ... FAILED
312-
tests/actual_tests_bless/revisioned_executable_panic.rs (run) ... FAILED
313-
tests/actual_tests_bless/revisioned_executable_panic.rs (panic) ... ok
314-
tests/actual_tests_bless/revisions.rs (foo) ... ok
315-
tests/actual_tests_bless/revisions.rs (bar) ... ok
316-
tests/actual_tests_bless/revisions_bad.rs (foo) ... ok
317-
tests/actual_tests_bless/revisions_bad.rs (bar) ... FAILED
318-
tests/actual_tests_bless/revisions_filter.rs (foo) ... ignored (in-test comment)
319-
tests/actual_tests_bless/revisions_filter.rs (bar) ... ignored (in-test comment)
320-
tests/actual_tests_bless/revisions_filter2.rs (foo) ... ignored (in-test comment)
321-
tests/actual_tests_bless/revisions_filter2.rs (bar) ... ok
322-
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (foo) ... ok
323-
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (bar) ... ok
324-
tests/actual_tests_bless/revisions_same_everywhere.rs (foo) ... ok
325-
tests/actual_tests_bless/revisions_same_everywhere.rs (bar) ... ok
310+
tests/actual_tests_bless/revisioned_executable.rs (revision `run`) ... ok
311+
tests/actual_tests_bless/revisioned_executable.rs (revision `panic`) ... FAILED
312+
tests/actual_tests_bless/revisioned_executable_panic.rs (revision `run`) ... FAILED
313+
tests/actual_tests_bless/revisioned_executable_panic.rs (revision `panic`) ... ok
314+
tests/actual_tests_bless/revisions.rs (revision `foo`) ... ok
315+
tests/actual_tests_bless/revisions.rs (revision `bar`) ... ok
316+
tests/actual_tests_bless/revisions_bad.rs (revision `foo`) ... ok
317+
tests/actual_tests_bless/revisions_bad.rs (revision `bar`) ... FAILED
318+
tests/actual_tests_bless/revisions_filter.rs (revision `foo`) ... ignored (in-test comment)
319+
tests/actual_tests_bless/revisions_filter.rs (revision `bar`) ... ignored (in-test comment)
320+
tests/actual_tests_bless/revisions_filter2.rs (revision `foo`) ... ignored (in-test comment)
321+
tests/actual_tests_bless/revisions_filter2.rs (revision `bar`) ... ok
322+
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (revision `foo`) ... ok
323+
tests/actual_tests_bless/revisions_multiple_per_annotation.rs (revision `bar`) ... ok
324+
tests/actual_tests_bless/revisions_same_everywhere.rs (revision `foo`) ... ok
325+
tests/actual_tests_bless/revisions_same_everywhere.rs (revision `bar`) ... ok
326326
tests/actual_tests_bless/run_panic.rs ... ok
327-
tests/actual_tests_bless/rustfix-fail-revisions.rs (a) ... FAILED
328-
tests/actual_tests_bless/rustfix-fail-revisions.rs (b) ... FAILED
327+
tests/actual_tests_bless/rustfix-fail-revisions.rs (revision `a`) ... FAILED
328+
tests/actual_tests_bless/rustfix-fail-revisions.rs (revision `b`) ... FAILED
329329
tests/actual_tests_bless/rustfix-fail.rs ... FAILED
330330
tests/actual_tests_bless/unknown_revision.rs ... FAILED
331331
tests/actual_tests_bless/unknown_revision2.rs ... FAILED
@@ -780,8 +780,8 @@ FAILURES:
780780
test result: FAIL. 20 failed; 14 passed; 3 ignored;
781781

782782
Building dependencies ... ok
783-
tests/actual_tests_bless_yolo/revisions_bad.rs (foo) ... ok
784-
tests/actual_tests_bless_yolo/revisions_bad.rs (bar) ... FAILED
783+
tests/actual_tests_bless_yolo/revisions_bad.rs (revision `foo`) ... ok
784+
tests/actual_tests_bless_yolo/revisions_bad.rs (revision `bar`) ... FAILED
785785
tests/actual_tests_bless_yolo/rustfix-maybe-incorrect.rs ... ok
786786

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

0 commit comments

Comments
 (0)