Closed
Description
I have a fresh Rust library, started with cargo new --lib foo
, and I have the following in lib.rs
:
/// Adds 1
/// ```edition2018
/// assert_eq!(1 + 1, 999)
/// ```
pub fn add_1(n: i32) -> i32 {
n + 1
}
I can cargo build
and cargo test
this library. The doctest is obviously never run because 1 + 1 == 999
is false. The output from cargo test
confirms this, showing that zero test were run.
The doctest book lead me to believe the doctest should still work, even if marked as edition2018
.
Cargo.toml
is:
[package]
name = "foo"
version = "0.1.0"
authors = ["..."]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cargo version: cargo 1.38.0 (23ef9a4ef 2019-08-20)
rustc version: rustc 1.38.0 (625451e37 2019-09-23)