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.
Doctesting examples don't work #1656
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
cargo test
Expected Results
Test to run and pass
Actual Results
Test runs but fails
Attempts to fix
I tried taking off the doccomments scope, that didn't help it to pass.
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
source: https://github.com/rust-lang/rust-by-example/blob/47a386d1af7e7ddd79464d0078f9c2bc1d515c06/src/testing/doc_testing.md
I'm doing something noobie wrong, but it would be great if the doc examples run out of the box correctly. Thanks :)