3 ms·
IMO more than made up for by providing the tooling out of the box. It's easier to write your basic tests in Rust than it is in many languages because the Rust e
by tialaramex 4y ago
IMO more than made up for by providing the tooling out of the box. It's easier to write your basic tests in Rust than it is in many languages because the Rust ecosystem already knows how to do unit testing and doc tests as supplied.
If you write comments with triple slashes, they're (Markdown format) documentation in Rust. If you use that Markdown to write an example of how to use something in your documentation, Rust's out of box tooling will assume that it should check your documented code works, by default. So you go from "I wrote an example in the source code of how to call my foo() function" to "I have basic HTML document for foo() and a test proving foo() basically works" in zero steps.
/// Appends an element to the back of a collection.
///
/// # Examples
///
/// ```
/// let mut vec = vec![1, 2];
/// vec.push(3);
/// assert_eq!(vec, [1, 2, 3]);
/// ```