google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
27.96k stars 1.67k forks source link

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

Closed mering closed 2 weeks ago

mering commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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!