Rust logo
Rust 1.77.2
25ef9e3d8

Testing

There is a new edition of the book and this is an old link.

Rust includes support for writing software tests within the language itself.

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}
Run

Here are the relevant sections in the new and old books: