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 New Should Have Tests #11837

Closed
JimLynchCodes opened this issue Mar 13, 2023 · 3 comments
Closed

Cargo New Should Have Tests #11837

JimLynchCodes opened this issue Mar 13, 2023 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@JimLynchCodes
Copy link

Problem

why is there no unit test in the project created with cargo new??

Proposed Solution

No response

Notes

No response

@JimLynchCodes JimLynchCodes added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Mar 13, 2023
@weihanglo
Copy link
Member

cargo new by default creates a package with a main binary target, so no unit tests for it. If you run cargo new --lib it does create a unit test for the new “library” package. Cargo tries to put a proper amount of code of a new project.

Do you have any thought on what a unit test should look like in a package with a binary target?

@weihanglo
Copy link
Member

In the meantime, you could take a look at some cargo extensions from crates.io, like cargo-generate which does project customizations.

For further discussion of creating a new package from pre-defined templates, please see #5151.

@JimLynchCodes
Copy link
Author

Interesting... ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants