Skip to content

Clarify in the book when rustdoc tests are run #24228

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

Closed
contradictioned opened this issue Apr 9, 2015 · 2 comments
Closed

Clarify in the book when rustdoc tests are run #24228

contradictioned opened this issue Apr 9, 2015 · 2 comments

Comments

@contradictioned
Copy link
Contributor

The new chapter on documentation is great, but in my opinion the documentation tests are still missleading.

When you

  1. create a crate with cargo new --bin mycrate
  2. write a doc test
  3. run cargo test

it will not run this doctest, only if the create was created without the --bin flag. This behaviour is documented in the crates manifest but this should be noted directly in the book. Particularly as I think, most readers of the book will play around with a project with a main.rs but not with a lib.rs.

@thiagooak
Copy link
Contributor

Why do we run them on cargo test only for libraries?

Would be nice to know in order to write the docs.

That's right, cargo test tests embedded documentation too.

Note that cargo test will run the embedded documentation tests on libraries only, 
we do not run it on binary programs in order to... / because ...

@contradictioned
Copy link
Contributor Author

I have no idea, in the discussion in the IRC we just did not really have any reasoning. (But I'm a rust noob :) )

steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 16, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 16, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 17, 2015
GuillaumeGomez pushed a commit to GuillaumeGomez/rust that referenced this issue Apr 17, 2015
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 a pull request may close this issue.

3 participants