Writing Automated Tests
In this chapter, we'll explore write tests to verify your code works correctly.
Writing Automated Tests
Testing is a complex skill. This chapter covers the mechanics of writing tests in Mana:
- How to Write Tests — The basics of testing
- Controlling How Tests Are Run — Test execution options
- Test Organization — Structure tests effectively
The Anatomy of a Test Function
A test in Mana is a function annotated with the #[test] attribute:
#[test]
fn it_works() -> void {
let result = 2 + 2
assert_eq(result, 4)
}Run tests with:
mana testLet's start with How to Write Tests.