rustdoc splits test-args wrongly
rustdoc is splitting test-args using split_whitespace, it should use something like shlex.
After the output of rusdoc testing changes, it is not possible to run a specific test anymore. For example, consider a x.rs file:
/// ```
/// assert!(true);
/// ```
fn f() { }
With stable compiler (1.15.1), this run the test
rustdoc +stable x.rs --test --test-args --exact --test-args "f_0"
With nightly compiler (1.17.0-nightly (ba7cf7cc5 2017-02-11)), this does not run the test
rustdoc +nightly x.rs --test --test-args --exact --test-args "x.rs - line 1"
Note that I'm taking the test name using rustdoc +stable x.rs --test --test-args --list
It would be great if something like rustdoc +nightly x.rs --test --test-args '--exact "x.rs - line 1"' worked.
cc @GuillaumeGomez
Marco A L Barbosa at 2017-02-13 17:39:41
As far as I can tell, it has been like this way before I made this change. However you're right, we shouldn't parse this way.
Also, please note that it's now possible to do:
rustdoc +stable x.rs --test --test-args --exact --test-args "f"Since this PR got merged.
Guillaume Gomez at 2017-02-13 19:09:43
I'd like to note that allowing multiple test-args and not splitting would allow a fool proof, but not too convenient way to easily cover all possible argument contents. Could be implemented with an alternate to
--test-argsthat doesn't split (say,--test-arg) for backwards compatibility.Cody Schafer at 2017-02-13 19:32:59
@GuillaumeGomez You assigned this to yourself, but I believe nothing has been done here -- it's not super clear to me what direction we want to take either; I think the two main proposals are
--test-arg(probably passable multiple times) and splitting with something like shlex. We could use shlex today fairly easily, though I'm uncertain that's the best solution here. The crate doesn't look quite ideal to its handling of only UTF-8 data (taking and returning &str) when it doesn't appear strictly necessary.Mark Rousskov at 2017-05-22 21:33:58
I didn't do anything on this because I'm not convinced by the proposed suggestion. I wanted to talk about it in a doc meeting but completely forgot. Adding needed tags.
EDIT: it seems it has already be done actually so I guess we can just close this issue.
Guillaume Gomez at 2017-05-23 07:55:58
@GuillaumeGomez I do not see any change in the code. What do you mean by "it seems it has already be done actually"?
Marco A L Barbosa at 2017-05-23 18:56:33
Indeed, my bad. Went way too quickly when looking at the code.
Guillaume Gomez at 2017-05-24 12:48:14