-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closes report doctest line numbers in a clickable format #143839
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rustbot has assigned @GuillaumeGomez. Use |
if let Some((left, _)) = s.split_once(" - ") { | ||
let path_with_line = left.rsplit("test ").next().unwrap(); | ||
let (path, line_number) = | ||
path_with_line.rsplit_once(":").expect("line number not found"); | ||
let path = fs::canonicalize(&path).expect("failed to canonicalize"); | ||
let path = path.to_str().unwrap().replace('\\', "/"); | ||
if let Some(ref mut v) = files.get_mut(&path) { | ||
tested += 1; | ||
let mut iter = right.split("(line "); | ||
iter.next(); | ||
let line = iter | ||
.next() | ||
.unwrap_or(")") | ||
.split(')') | ||
.next() | ||
.unwrap_or("0") | ||
.parse() | ||
.unwrap_or(0); | ||
if let Ok(pos) = v.binary_search(&line) { | ||
if let Ok(pos) = v.binary_search(&line_number.parse::<usize>().unwrap_or(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion: hm, this seems rather fragile 🤔 But I don't feel like blocking on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you recommend? Didn't want to change much of the logic here since s
is the entire test name.
@@ -1,7 +1,7 @@ | |||
|
|||
running 2 tests | |||
test doctest.rs - (line 4) ... ok | |||
test doctest.rs - init (line 8) ... ok | |||
test doctest.rs:4 ... ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output is much less good though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new output is less good.
closes #142984
Added a change to the add the line number to the file name to make it clickable