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

Correctly fix formatting doc tests with generics #11490

Merged
merged 2 commits into from
Feb 21, 2022

Conversation

SeniorMars
Copy link
Contributor

@SeniorMars SeniorMars commented Feb 18, 2022

Before the doc_test would be outputted like this:

"Foo<T, U>::t"

However, this would cause problems with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under quotes as so:

"\"Foo<T, U>::t\""

Note:
At the cost of adding this, I had to allocate a new string via
format!{}. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:

runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl

Closes #11489

Before the doc_test would be outputted like this:
"Foo<T, U>::t"
However, this would cause shells with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under escape
chanters as so:
"\"Foo<T, U>::t\""

Note:
At the cost of adding this, I had to allocate a new string via
format!{}. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
@Veykril
Copy link
Member

Veykril commented Feb 21, 2022

Thanks!
bors r+

@bors
Copy link
Contributor

bors bot commented Feb 21, 2022

@bors bors bot merged commit c0ee2f2 into rust-lang:master Feb 21, 2022
@lnicola lnicola mentioned this pull request Apr 27, 2022
bors added a commit that referenced this pull request Apr 27, 2022
Revert #11490

Closes #11725

#11490 was a little misguided. Quoting the test name should be a client concern, since it's the client that actually runs `cargo`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Generics doc_test -- format with escape characters or quotes
2 participants