rust/tests/target/issue-3158.rs
Nipunn Koorapati b10ab51fed rustfmt doc code blocks with multiple comma-separated attributes
Added test covering this. Chose to treat the code block
as rust if and only if all of the comma-separated attributes
are rust-valid. Chose to allow/preserve whitespace around commas

Fixes #3158
2021-09-08 23:27:51 -05:00

75 lines
1.1 KiB
Rust

// rustfmt-format_code_in_doc_comments: true
/// Should format
/// ```rust
/// assert!(false);
/// ```
///
/// Should format
/// ```rust,should_panic
/// assert!(false);
/// ```
///
/// Should format
/// ```rust,should_panic,edition2018
/// assert!(false);
/// ```
///
/// Should format
/// ```rust , should_panic , edition2018
/// assert!(false);
/// ```
///
/// Should not format
/// ```ignore
/// assert!( false );
/// ```
///
/// Should not format (not all are rust)
/// ```rust,ignore
/// assert!( false );
/// ```
///
/// Should not format (rust compile_fail)
/// ```compile_fail
/// assert!( false );
/// ```
///
/// Should not format (rust compile_fail)
/// ```rust,compile_fail
/// assert!( false );
/// ```
///
/// Various unspecified ones that should format
/// ```
/// assert!(false);
/// ```
///
/// ```,
/// assert!(false);
/// ```
///
/// ```,,,,,
/// assert!(false);
/// ```
///
/// ```,,, rust ,,
/// assert!(false);
/// ```
///
/// Should not format
/// ```,,, rust , ignore,
/// assert!( false );
/// ```
///
/// Few empty ones
/// ```
/// ```
///
/// ```rust
/// ```
///
/// ```ignore
/// ```
fn foo() {}