-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Display correct filename with --test option #39597
Display correct filename with --test option #39597
Conversation
Can you be sure to add a test for this as well? |
@alexcrichton: So I came up with a solution, does it seem ok to you? |
@bors: r+ |
📌 Commit d92abb3 has been approved by |
…_file, r=alexcrichton Display correct filename with --test option Fixes rust-lang#39592. With the current files: ```rust pub mod foo; /// This is a Foo; /// /// ``` /// println!("baaaaaar"); /// ``` pub struct Foo; /// This is a Bar; /// /// ``` /// println!("fooooo"); /// ``` pub struct Bar; ``` ```rust // note the whitespaces /// ``` /// println!("foo"); /// ``` pub fn foo() {} ``` It displays: ``` ./build/x86_64-apple-darwin/stage1/bin/rustdoc --test test.rs running 3 tests test test.rs - line 13 ... ok test test.rs - line 5 ... ok test foo.rs - line 2 ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured ``` ``` ` `` println!("lol"); ` `` asdjnfasd asd ``` It displays: ``` ./build/x86_64-apple-darwin/stage1/bin/rustdoc --test foo.md running 1 test test <input> - line 3 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ``` r? @alexcrichton
src/tools/compiletest/src/runtest.rs
Outdated
&format!("Not found doc test: \"{}\" in {:?}", s, v), | ||
&res); | ||
let path = tmp[0].rsplit("test ").next().unwrap(); | ||
println!("{:?}", path); |
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.
Is this println
really supposed to be here?
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.
No, absolutely not! Thanks a lot for notifying it!
I don't know if this PR addresses the entire issue. Another thing that I can't do anymore is run a subset of the doctests by specifying a prefix: This PR also doesn't address another part of #39592: the module/function name being tested is no longer printed. I have no idea what's on line 194 of |
d92abb3
to
d2f8abf
Compare
@bors: r+ r=alexcrichton |
📌 Commit d2f8abf has been approved by |
@SergioBenitez: |
This is not the way things worked before, however, and frankly, I don't believe this makes any sense. There is now a strange inconsistency between I think this is incredibly confusing. What does "the ids of rustdoc were pretty stupid" mean? It's great that I now know the file/line the test is on (by the way, are those numbers actually correct? I'm seeing some strange numbers...), but I also want to know the logical path to the module. Like I said, I have no idea which function/item is in which file/line, and forcing me to check out the file individually is a huge bummer. I want to know the file/line if I'm going to go and fix it, but I want to know the module path when I just want to know what went wrong. Both pieces of information are useful. Nothing is stupid about wanting to have the full picture. |
The ids were stupid because they generally didn't give much indication. What happens if you have the same function name in multiple traits? Simply something beautiful like this:
Super useful, indeed. And I don't even speak when you run |
…_file, r=alexcrichton Display correct filename with --test option Fixes rust-lang#39592. With the current files: ```rust pub mod foo; /// This is a Foo; /// /// ``` /// println!("baaaaaar"); /// ``` pub struct Foo; /// This is a Bar; /// /// ``` /// println!("fooooo"); /// ``` pub struct Bar; ``` ```rust // note the whitespaces /// ``` /// println!("foo"); /// ``` pub fn foo() {} ``` It displays: ``` ./build/x86_64-apple-darwin/stage1/bin/rustdoc --test test.rs running 3 tests test test.rs - line 13 ... ok test test.rs - line 5 ... ok test foo.rs - line 2 ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured ``` ``` ` `` println!("lol"); ` `` asdjnfasd asd ``` It displays: ``` ./build/x86_64-apple-darwin/stage1/bin/rustdoc --test foo.md running 1 test test <input> - line 3 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ``` r? @alexcrichton
@GuillaumeGomez it seems like both indicators could be inserted in the test name, right? We could have both a small snippet of what file and also the old historical context for what's actually being tested. |
That's not what Cargo prints out at all. This is what gets printed out:
The logs includes the full path to the trait/function, not just the function name, thus disambiguating. I do agree that the The other issue I have with this new format is that it uses absolute paths; they're just too long. I don't care about the absolute path to my project; I ran I think something like this would look nice:
This is concise, informative, and includes all of the old and new information. |
Having the two pieces of information could be useful, indeed. I can add it back (without the |
Fixes #39592.
With the current files:
test.rs
foo.rs
It displays:
And with a markdown file:
It displays:
r? @alexcrichton