TDD For Rust Development
cargo test
I was actually rather confused that a simple -w or --watch on the end just gave me errors that they were unrecognized flags. Shoutout to my friends on Reddit for responding to me question on this, and it turns out in Cargo land there is a completely different tool, cargo-watch.
But it's rather easy to install:
cargo install cargo-watch
Yay! Now you should be able to use it! This library actually integrates into cargo, and our first command is still cargo, but then we call watch, followed by the "-x" and the command we want it to rerun, which in this case is just test.
Phew, so when we put it all together it looks like this:
cargo watch -x test
Interestingly, it seems that it also works when I use cargo-watch directly:
cargo-watch -x test
If you are curious about this mystery like me, feel free to check out and comment on this Github issue about this very thing.