- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
guide: add a testing section to the contributing guide #598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
CONTRIBUTING.md
Outdated
|
||
Ideally, every API has at least one documentation test that demonstrates how to | ||
use the API. Documentation tests are run with `cargo test --doc`. This ensures | ||
that the example is correct and provides additional test coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIOLI: might be good to link to https://doc.rust-lang.org/rustdoc/documentation-tests.html somewhere in here?
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few spelling nits and one sentence reword, otherwise this is good. 👍
CONTRIBUTING.md
Outdated
use the API. Documentation tests are run with `cargo test --doc`. This ensures | ||
that the example is correct and provides additional test coverage. | ||
|
||
The trick to documentation tests is stricking a balance between being susinct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: stricking
-> striking
, sucinct
-> succinct
CONTRIBUTING.md
Outdated
`FutureExt::timeout`, this is how the documentation test is structured. | ||
|
||
Lines that start with `/// #` are removed when the documentation is generated. | ||
They are onlly there to get the test to run. The `block_on_all` function is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: onlly
-> only
CONTRIBUTING.md
Outdated
|
||
#### Integration tests | ||
|
||
Integration tests go in the crate that they are test. Each sub crate should have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reword this slightly? Integration tests go in the same crate as the code they are testing
, perhaps?
Motivation
We would like contributors to be able to help out with documentation tests
Solution
Add some notes in the guide on how to write tests.