After learning (and I’m still learning) basics of Rust, I decided that I need
to work on real world project to get better understanding of the language and
face real problems 😄
Introducing snb1 - Superfast notes
from the terminal 🎉
After my previous post I came across other ways to “quickly test rust code”
Obvious being rust-script
It is easy to install via cargo install rust-script (But I had it already installed. I think Espanso installed it, but not too sure)
This may be better than rustc because one can define the dependencies in the “script” itself, like :
#!/usr/bin/env rust-script //! Dependencies can be specified in the script file itself as follows: //!
In rust, tests are written in the same file as the code. But I want to have the tests in a separate file.
Conventionally, only the integration tests are written in files under tests folder. 1
I just wanted to have the unit tests in a separate file. So I created a file src/my_tests.rs and moved all the tests there.
But cargo test kept saying running 0 tests
Turns out, I’m not the only one.