-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentation
Description
Hi there folks,
I was preparing an introduction to cargo to share with some coworkers and I wanted to show how the documentation testing works.
So I created a binary project to show a 'Hello world' and added a documentation code that should fail to exemplify the documentation testing, but it didn't run with cargo test
.
Here are examples to reproduce:
cargo new --bin binary
cd binary
echo '///```
///assert_eq!(1, 2);
///```
fn main() {
println!("Hello, world!");
}
' > src/main.rs
cargo test
# Expected: 1 doc-test failed, found 0 failures
cargo new library
cd library
echo '///```
///assert_eq!(1, 2);
///```
fn lib() {
println!("Hello, world!");
}
' > src/lib.rs
cargo test
# Expected: 1 doc-test failed, found 1 failure
Thanks and keep the good work folks! (:
Metadata
Metadata
Assignees
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentation