Skip to content

Commit 471d6d3

Browse files
authored
Rollup merge of rust-lang#72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPC
remove extra space from crate-level doctest names Before: ``` running 2 tests test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` After: ``` running 2 tests test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ```
2 parents 6f0b2b7 + ce915f5 commit 471d6d3

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/librustdoc/test.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,11 @@ impl Collector {
676676
}
677677

678678
fn generate_name(&self, line: usize, filename: &FileName) -> String {
679-
format!("{} - {} (line {})", filename, self.names.join("::"), line)
679+
let mut item_path = self.names.join("::");
680+
if !item_path.is_empty() {
681+
item_path.push(' ');
682+
}
683+
format!("{} - {}(line {})", filename, item_path, line)
680684
}
681685

682686
pub fn set_position(&mut self, position: Span) {

src/test/rustdoc-ui/doctest-output.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// compile-flags:--test
2+
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
3+
// check-pass
4+
5+
//! ```
6+
//! assert_eq!(1 + 1, 2);
7+
//! ```
8+
9+
pub mod foo {
10+
11+
/// ```
12+
/// assert_eq!(1 + 1, 2);
13+
/// ```
14+
pub fn bar() {}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
running 2 tests
3+
test $DIR/doctest-output.rs - (line 5) ... ok
4+
test $DIR/doctest-output.rs - foo::bar (line 11) ... ok
5+
6+
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
7+

0 commit comments

Comments
 (0)