4 ms·
You cut down a chunk of tests by not needing to figure out what type something is. You can also use assert! and assert_eq! in your main code without even using
by stmblast 3y ago
You cut down a chunk of tests by not needing to figure out what type something is. You can also use assert! and assert_eq! in your main code without even using tests which also cuts down on tests, where applicable.
You can also write unit tests in the same files as your main code. Eventually you'll want some kind of test suite when your codebase gets big enough, but it works well enough that you don't need to if you don't want to (for a small codebase).
Frameworks like Axum also of course support testing - for instance this crate lets you quickly mock up your server without having to do much: https://docs.rs/axum-test/latest/axum_test/ https://docs.rs/axum-test/latest/axum_test/
- TylerE 3y ago> You cut down a chunk of tests by not needing to figure out what type something is I have literally never written such a test in a rapid prototyping context.
- norman784 3y agoWhen you are prototyping you change code here and there, so a type system helps in that regard and I consider type system as a kind of test. So by having that built in, you need to write less tests, but AFAIK python has an optional type system, not sure how that works, but I suppose it would help in that regard.
- TylerE 3y agoIf find that exactly the situation where a type system is intrusive, not helpful.