Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct file/line for doctests on both inner and outer attributes #79770

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/test/rustdoc-ui/issue-79764/a/another_mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! ```
//! // ^ a/another_mod.rs line 1
//! assert_eq!(1, 1);
//! ```
Empty file.
10 changes: 10 additions & 0 deletions src/test/rustdoc-ui/issue-79764/a/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//! ```
//! // ^ a/mod.rs line 1
//! assert_eq!(1, 1);
//! ```

/// ```
/// // ^ a/mod.rs line 6
/// assert_eq!(1, 1);
/// ```
pub mod another_mod;
14 changes: 14 additions & 0 deletions src/test/rustdoc-ui/issue-79764/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// check-pass
// compile-flags:--test
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

// The literal `mod` in the doctest comments makes rustdoc emit a bogus
// `extern crate mod;` line which would break the doctests.
#![doc(test(no_crate_inject))]

/// ```
/// // ^ mod.rs line 10
/// assert_eq!(1, 1);
/// ```
pub mod a;
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/issue-79764/mod.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

running 4 tests
test $DIR/issue-79764/mod.rs - a (line 14) ... ok
test $DIR/issue-79764/mod.rs - a (line 10) ... ok
test $DIR/issue-79764/a/mod.rs - a::another_mod (line 6) ... ok
test $DIR/issue-79764/a/mod.rs - a::another_mod (line 10) ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME