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

Support running example targets #210

Closed
yuhr opened this issue Apr 21, 2023 · 2 comments
Closed

Support running example targets #210

yuhr opened this issue Apr 21, 2023 · 2 comments

Comments

@yuhr
Copy link

yuhr commented Apr 21, 2023

In my sandbox project I put hello.rs containing a main function in the examples directory, and I can confirm cargo run --example hello works, but trycmd just ignores test cases that start with $ hello, probably due to #105. Would be good if it supports example targets.

@epage
Copy link
Contributor

epage commented Apr 21, 2023

We do support examples today; they just aren't automatic due to limitations of cargo (bins are built automatically, examples aren't). See clap as an example of how to register examples

@yuhr
Copy link
Author

yuhr commented Apr 22, 2023

Thank you for pointing out, the example is illuminating! It seemed to be already documented but I couldn't reach to that file until you told me, so IMHO linking directly to tests/examples.rs file in the documentation would be more helpful.

@yuhr yuhr closed this as completed Apr 22, 2023
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

No branches or pull requests

2 participants