Enhance documentation of testing#10726
Merged
bors merged 9 commits intorust-lang:masterfrom Jun 5, 2022
Merged
Conversation
- Mention that in `src/` Cargo also collect doc tests. - Remove outdated statement: Cargo no longer tests examples by default. - Add a link to "Cargo Targets: Tests" to help people learn about it.
NOTE: This is an undocumented implementation details.
|
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
epage
reviewed
Jun 3, 2022
Contributor
|
Overall, looks like a good improvement. Addressing the wording tweak is all I see thats needed before merging |
ehuss
reviewed
Jun 3, 2022
src/doc/man/cargo-bench.md
Outdated
| the test harness to tell it to run only benchmarks. | ||
| Benchmarks are built with the `--test` option to `rustc` which creates a | ||
| special executable by linking your code with libtest. The executable | ||
| automatically runs all functions annotated with the `#[test]` attribute. |
Contributor
There was a problem hiding this comment.
Suggested change
| automatically runs all functions annotated with the `#[test]` attribute. | |
| automatically runs all functions annotated with `#[test]` and `#[bench]` attributes. |
I was slightly confused reading this due to the mention of #[test]. I'm not sure if this is any clearer. This is delving into some low-level details that is mostly not relevant to the average user.
Member
Author
There was a problem hiding this comment.
Ok. Now I feel like mentioning #[bench] is enough. I'll put it back then.
- Rephrase doctest exec model as "not guranteed and may change" instead - Mention `#[bench]` in what cargo-bench automatically runs - Make it clear for build/rustc when mentioning bin targets auto-built
epage
reviewed
Jun 4, 2022
This is too details and not for averaged users.
Contributor
|
Thanks! I pushed a small wording tweak. @bors r=epage |
Contributor
|
📌 Commit 5d33609 has been approved by |
Contributor
Contributor
|
☀️ Test successful - checks-actions |
This was referenced Jun 5, 2022
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 8, 2022
Update cargo 7 commits in 38472bc19f2f76e245eba54a6e97ee6821b3c1db..85e457e158db216a2938d51bc3b617a5a7fe6015 2022-05-31 02:03:24 +0000 to 2022-06-07 21:57:52 +0000 - Make -Z http-registry use index.crates.io when accessing crates-io (rust-lang/cargo#10725) - Respect submodule update=none strategy in .gitmodules (rust-lang/cargo#10717) - Expose rust-version through env var (rust-lang/cargo#10713) - add validation for string "true"/"false" in lto profile (rust-lang/cargo#10676) - Enhance documentation of testing (rust-lang/cargo#10726) - Clear disk space on CI. (rust-lang/cargo#10724) - Enforce to use tar v0.4.38 (rust-lang/cargo#10720)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Enhance Cargo docs a bit on testing topic. Related issues:
How should we test and review this PR?
All changes are described in commit message.
You can build the doc and help proofread some of these pages:
Additional information
I am not sure whether we should include undocumented execution model of doctests, which is the last commit, though I added a warning pointing out this truth. I can drop it if anyone in the team disagrees.