Skip to content

Commit 1d83f9b

Browse files
committed
test(rules): add indented code block test for MD013 doc comment skip
1 parent 458a2e6 commit 1d83f9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/doc_comment_lint_tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,25 @@ fn foo() {}
668668
);
669669
}
670670

671+
/// MD013 should not flag long lines inside indented code blocks in doc comments.
672+
#[test]
673+
fn test_md013_skips_indented_code_blocks_in_doc_comments() {
674+
let content = "/// # Examples\n///\n/// let very_long_variable_name_that_exceeds_eighty_characters = some_function_with_a_long_name(argument_one, argument_two);\n///\nfn foo() {}\n";
675+
676+
let rules = default_rules();
677+
let config = Config::default();
678+
let warnings = check_doc_comment_blocks(content, &rules, &config);
679+
680+
let md013_warnings: Vec<_> = warnings
681+
.iter()
682+
.filter(|w| w.rule_name.as_deref() == Some("MD013"))
683+
.collect();
684+
assert!(
685+
md013_warnings.is_empty(),
686+
"MD013 should not flag indented code blocks in doc comments, got: {md013_warnings:?}"
687+
);
688+
}
689+
671690
/// MD013 should still flag long prose lines in doc comments.
672691
#[test]
673692
fn test_md013_still_flags_long_prose_in_doc_comments() {

0 commit comments

Comments
 (0)