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

Cargo documentation test page should have link or example on how to define a test #10415

Closed
davidpaulmcintyre opened this issue Feb 23, 2022 · 2 comments
Labels
A-documenting-cargo-itself Area: Cargo's documentation C-bug Category: bug

Comments

@davidpaulmcintyre
Copy link
Contributor

Problem

A google search for “cargo test” takes me to this page https://doc.rust-lang.org/cargo/commands/cargo-test.html, which is also the top result returned when searching from within https://doc.rust-lang.org/stable/cargo/.

As a new rust user, i feel that there are only 2 code snippets i need from this page:

  • cargo test
  • #[test]

The first item is present, the second is not. If this second bit of info is not present on this page (maybe justifiably bc there are different test types), there should be a link to a page that does contain it, notably https://doc.rust-lang.org/stable/cargo/reference/cargo-targets.html?highlight=cargo%20test#tests.

i would be happy to submit pr if this is acceptable.

Steps

  1. search for "cargo test" in a search engine or from w/in the cargo search box
  2. open result, which is https://doc.rust-lang.org/cargo/commands/cargo-test.html
  3. observe there is no assistance in how to define a test or where to find this info

Possible Solution(s)

Under "SEE ALSO" there should be a link to https://doc.rust-lang.org/stable/cargo/reference/cargo-targets.html?highlight=cargo%20test#tests w/ the description "How to define a test".

Notes

if everyone agrees w/ me, pls assign this to me and i'll create a pr w/ a link

Version

current version of the online docs
@davidpaulmcintyre davidpaulmcintyre added the C-bug Category: bug label Feb 23, 2022
@Eh2406
Copy link
Contributor

Eh2406 commented Feb 23, 2022

Improving documentation is almost always welcome!

From https://doc.rust-lang.org/cargo/commands/cargo-test.html,

and check out the rustc book's chapter on how tests work at https://doc.rust-lang.org/rustc/tests/index.html.

Perhaps that sentence could be reworked to make it clear that it is also the link for "how to write tests".

@weihanglo weihanglo added the A-documenting-cargo-itself Area: Cargo's documentation label Feb 25, 2022
@weihanglo
Copy link
Member

Fixed with #10417. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants