I have a doctest in my shell_parse crate that includes a shell-style comment at the start of a line, inside a code block. Minimal example:
/// ```rust
/// let test_string = r#"
/// # Help me
/// "#;
/// ```
This causes the hash to be stripped out in cargo doc output (which is annoying, because it's part of the example), and causes the parsing to fail and the doctest to fail as a result. Using the same code in a normal test does not fail, and replacing the # with ## causes it to appear in documentation output and the test to succeed. This is the approach I've taken as a workaround, but it's not what I actually want.
I have a doctest in my
shell_parsecrate that includes a shell-style comment at the start of a line, inside a code block. Minimal example:This causes the hash to be stripped out in
cargo docoutput (which is annoying, because it's part of the example), and causes the parsing to fail and the doctest to fail as a result. Using the same code in a normal test does not fail, and replacing the#with##causes it to appear in documentation output and the test to succeed. This is the approach I've taken as a workaround, but it's not what I actually want.