3 ms·
I wonder if this is hurts testing culture with Rust. People think the compiler is magical enough they doing out a lot of energy into writing good tests still
by no_wizard 4y ago
I wonder if this is hurts testing culture with Rust. People think the compiler is magical enough they doing out a lot of energy into writing good tests still
- dcow 4y agoYou still need functional tests in rust.
- tialaramex 4y agoIMO 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]); /// ```