-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 test
does not run documentation tests on binary projects
#2009
Comments
cargo test
does not run documentation on binary projectscargo test
does not run documentation test on binary projects
cargo test
does not run documentation test on binary projectscargo test
does not run documentation tests on binary projects
This is actually a rustdoc 'bug', though I can't seem to find it. Basically, Rustdoc, in its current form, needs to link to your library, and so this is just an inherent limitation of it right now. /cc @alexcrichton do you remember where that bug is? |
Yeah @steveklabnik hit this right on the money, in the case of a binary there's no library to link against (because it's a binary), so this is an inherent limitation of rustdoc itself. If you end up writing lots of functions and documenting heavily in a binary, moving them to a library in the same repo should do the trick! |
Thanks for the explanation folks. Would it make sense to add this information on the documentation about documentation? I think it would be interesting to explain why there is such limitation currently and suggest to move the logic into a library on the same like @alexcrichton said. I could try to do that later if it makes sense. Cheers. |
Oh dear, this should definitely be in the docs! I'll leave this open to ensure a mention can be added there. |
I believe it's already mentioned in Rust's docs. I don't know how much
behavior we want to duplicate across both Rust and Cargo though.
|
@steveklabnik: now that you mentioned, I found it already documented on Rust. I was about to send a PR on documentation Rust. I think this could be closed. Sorry about that. |
It's all good! I think that this is just hard in general, right? It's part
of having tools that are composed together. We have a behavior of rustdoc
that's called by cargo, which is documented in rust...
|
Is this related to modules? I have doc-tests in a module file, but rust-doc can't find them.
The weird thing is that |
Hi there folks,
I was preparing an introduction to cargo to share with some coworkers and I wanted to show how the documentation testing works.
So I created a binary project to show a 'Hello world' and added a documentation code that should fail to exemplify the documentation testing, but it didn't run with
cargo test
.Here are examples to reproduce:
Thanks and keep the good work folks! (:
The text was updated successfully, but these errors were encountered: