Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Writing and Running Tests – Rust Programming Tutorial #41

15K views on YouTube

dcode 42 tutorials here

Testing is relatively straightforward in Rust – it can be done using the ‘cargo test’ command. Once you have defined some tests in your source code, you are then able to run ‘cargo test’ to get your test results.

In this video I go over some basic examples of testing, how to use other modules + structs in your tests and some testing attributes.

For your reference, check this out:
https://doc.rust-lang.org/book/first-edition/testing.html

Follow me on Twitter @dcode!

If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!