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

Introduce #[test] before the first exercise (Fibonacci) #2461

Closed
mering opened this issue Nov 6, 2024 · 3 comments
Closed

Introduce #[test] before the first exercise (Fibonacci) #2461

mering opened this issue Nov 6, 2024 · 3 comments

Comments

@mering
Copy link

mering commented Nov 6, 2024

Using cargo's first class testing support is so much nicer than manually cargo run all the time during development. People should get used to writing tests instead of manually writing binaries for testing their code right from the beginning. Luckily it is introduced for the second exercise (Collatz length).

@djmitche
Copy link
Collaborator

djmitche commented Nov 6, 2024

Students need to see both approaches. Especially in the sandbox, the running a binary crate is pretty common and useful as it shows the output.

As you've observed, #[test] is used in the second exercise, and I think that's close enough to the beginning of the course to highlight both approaches.

@djmitche
Copy link
Collaborator

djmitche commented Nov 6, 2024

Ah, and I just remembered #1581 which would at least make this consistent. That's assigned to me but I'd be happy to reassign if you're willing to work on it!

@djmitche djmitche closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
@mgeisler
Copy link
Collaborator

Using cargo's first class testing support is so much nicer than manually cargo run all the time during development. People should get used to writing tests instead of manually writing binaries for testing their code right from the beginning.

Dustin is right that we need the more primitive "look at the output" approach right now — simply because of how we teach primarily using the embedded Playgrounds.

However, now that we have #2503 merged, which adds support for showing stderr output, we can also look at executing tests! Why, you will ask... because that PR made me realize that there are more advanced Playground API endpoints. We can send a request and tell the Playground to execute tests if we like.

@mering, please let us know if you want to get involved with that.

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

3 participants