-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Code blocks inside documentation are interpreted as doctests by default. Sometimes the code is not for testing at all (for example, writing pseudo-code for an algorithm), and we can add ignore
at the beginning of the code block.
However, even if ignore
is added, cargo test
still interprets the code block as doctest, and prints "... ignored" on each occurrence of ignore
-tagged code blocks. In fact, those code blocks should not be interpreted as doctest, and cargo test
should silently ignore those code blocks.
For example, the following code is a snippet of my current project.
/// Minimize the input size while preserving the coverage.
///
/// The algorithm trims by trying to remove chunks, starting from large chunks
/// to small chunks.
///
/// # Algorithm
/// ```ignore
/// for round in rounds {
/// for chunk_index in buffer {
/// let new_buffer = remove_chunk(chunk_index, round_size);
/// if run(new_buffer).coverage == known_coverage {
/// buffer = new_buffer;
/// }
/// }
/// }
/// ```
pub struct Trim {
...
}
cargo test
generates the following output:
[...]
Doc-tests dfuzz
running 4 tests
test src/algorithm/pass/mod.rs - algorithm::pass::Trim (line 17) ... ignored
test src/tracer/function.rs - tracer::function (line 18) ... ignored
test src/tracer/function.rs - tracer::function (line 23) ... ignored
test src/tracer/function.rs - tracer::function (line 5) ... ignored
Is it possible to add a flag in the code block to suppress such "ignored" messages?
shreevatsa, Sushisource, tavianator, chshersh, jtran and 4 more
Metadata
Metadata
Assignees
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Projects
Status
No status