Description
Summary
Doctests are such a great idea, but I'm struggling to get started. The examples don't work, ironically :P. I'm a Rust Noobie, and I was thinking by making some doctests I could build up a project I want to do in Rust more easily. I did get the unit testing section to work, currently 21.1. This was the section before documentation testing, currently 21.2.
Steps to Reproduce
- Take doctest example and paste it into https://play.rust-lang.org/
- Click the button that says equivalent to
cargo test
Expected Results
Test to run and pass
Actual Results
Test runs but fails
use of undeclared crate or module `doccomments`
Attempts to fix
I tried taking off the doccomments scope, that didn't help it to pass.
cannot find function `add` in this scope
I tried googling for doctest examples and couldn't get them to work in either the rust sandbox or my local computer with rust installed.
doctest example:
https://doc.rust-lang.org/rust-by-example/testing/doc_testing.html
I'm doing something noobie wrong, but it would be great if the doc examples run out of the box correctly. Thanks :)