Skip to content

Commit 3b29497

Browse files
bestgophersunshowers
authored andcommitted
feat: print module path in cyan
1 parent 26356ae commit 3b29497

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

nextest-runner/src/helpers.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
// Copyright (c) The nextest Contributors
22
// SPDX-License-Identifier: MIT OR Apache-2.0
33

4-
use owo_colors::{OwoColorize, Style};
4+
use crate::test_list::Styles;
5+
use owo_colors::OwoColorize;
56
use std::io::{self, Write};
67

78
/// Write out a test name.
8-
pub(crate) fn write_test_name(name: &str, style: Style, mut writer: impl Write) -> io::Result<()> {
9+
pub(crate) fn write_test_name(
10+
name: &str,
11+
style: &Styles,
12+
mut writer: impl Write,
13+
) -> io::Result<()> {
914
// Look for the part of the test after the last ::, if any.
1015
let mut splits = name.rsplitn(2, "::");
1116
let trailing = splits.next().expect("test should have at least 1 element");
1217
if let Some(rest) = splits.next() {
13-
write!(writer, "{}::", rest)?;
18+
write!(
19+
writer,
20+
"{}{}",
21+
rest.style(style.module_name),
22+
"::".style(style.module_name)
23+
)?;
1424
}
15-
write!(writer, "{}", trailing.style(style))?;
25+
write!(writer, "{}", trailing.style(style.test_name))?;
1626

1727
Ok(())
1828
}

nextest-runner/src/reporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl<'a> TestReporter<'a> {
583583
width = self.binary_id_width
584584
)?;
585585

586-
write_test_name(instance.name, self.styles.test_list.test_name, writer)
586+
write_test_name(instance.name, &self.styles.test_list, writer)
587587
}
588588

589589
fn write_duration(&self, duration: Duration, mut writer: impl Write) -> io::Result<()> {

nextest-runner/src/test_list.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl<'g> TestList<'g> {
406406
writeln!(indented, "(no tests)")?;
407407
} else {
408408
for (name, info) in &info.testcases {
409-
write_test_name(name, self.styles.test_name, &mut indented)?;
409+
write_test_name(name, &self.styles, &mut indented)?;
410410
if !info.filter_match.is_match() {
411411
write!(indented, " (skipped)")?;
412412
}
@@ -542,6 +542,7 @@ impl<'a> TestInstance<'a> {
542542
pub(super) struct Styles {
543543
pub(super) binary_id: Style,
544544
pub(super) test_name: Style,
545+
pub(super) module_name: Style,
545546
field: Style,
546547
}
547548

@@ -550,6 +551,7 @@ impl Styles {
550551
self.binary_id = Style::new().magenta().bold();
551552
self.test_name = Style::new().blue().bold();
552553
self.field = Style::new().yellow().bold();
554+
self.module_name = Style::new().cyan().bold();
553555
}
554556
}
555557

0 commit comments

Comments
 (0)