Uh oh!
There was an error while loading. Please reload this page.
Display correct filename with --test option - #39597
Conversation
alexcrichton
commented
Feb 6, 2017
Can you be sure to add a test for this as well? |
GuillaumeGomez
commented
Feb 6, 2017
@alexcrichton: So I came up with a solution, does it seem ok to you? |
alexcrichton
commented
Feb 7, 2017
@bors: r+ |
bors
commented
Feb 7, 2017
📌 Commit d92abb3 has been approved by |
…_file, r=alexcrichton Display correct filename with --test option Fixesrust-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
| &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.
Is this println really supposed to be here?
There was a problem hiding this comment.
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
d2f8abfCompare@bors: r+ r=alexcrichton |
bors
commented
Feb 8, 2017
📌 Commit d2f8abf has been approved by |
@SergioBenitez: |
SergioBenitez
commented
Feb 8, 2017
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. |
GuillaumeGomez
commented
Feb 8, 2017
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 Fixesrust-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
alexcrichton
commented
Feb 8, 2017
@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. |
SergioBenitez
commented
Feb 10, 2017
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. |
GuillaumeGomez
commented
Feb 10, 2017
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