3 ms·
That's included in Rust![1] Code examples from the documentation automatically become "documentation tests" to make sure your examples are still up to date whe
by Gadiguibou 6y ago
That's included in Rust![1]
Code examples from the documentation automatically become "documentation tests" to make sure your examples are still up to date when updating your code.
[1] https://doc.rust-lang.org/rustdoc/documentation-tests.html https://doc.rust-lang.org/rustdoc/documentation-tests.html
- Omin 6y agoThe README.md isn't part of the rust code, so it's not checked by this unless you use tools to generate your README from doc comments like https://github.com/livioribeiro/cargo-readme https://github.com/livioribeiro/cargo-readme.
- Rompect 6y agoActually, it's possible and even frequently used, for example in lazy-static, through the `doc_comment` crate. #[cfg(doctest)] #[macro_use] extern crate doc_comment; #[cfg(doctest)] doctest!("../README.md"); Now, the readme examples are tested like everything else. https://github.com/rust-lang-nursery/lazy-static.rs/blob/master/src/lib.rs#L105 https://github.com/rust-lang-nursery/lazy-static.rs/blob/mas...