Lesson 27 of 50
rustWriting Tests
15 minutes
Course progress54%
Writing Tests
Tests live in the tests directory or inline with #[cfg(test)].
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Lesson 27 of 50
rust15 minutes
Tests live in the tests directory or inline with #[cfg(test)].
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Run tests with cargo test.