In this article, we are going to learn how to write and run tests for Rust. Unit tests Rust made the interesting decision that unit tests should be written in the same files as the code under test. Let’s imagine we have a module with a function named add: 1 2 3 pub fn add(left: i64, right: i64) -> i64 { left + right } If we want to test that function, we would modify the file to look like this: