diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index 73054f9c4..ab2458ceb 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -255,6 +255,31 @@ mod tests { ); } + #[test] + fn section_parsing_with_additional_headers() { + let input = "\ + # ls\n\ + ## after section\n\ + This is some section\n\ + \n\ + ### level 3 header\n\ + \n\ + Additional text under the section.\n\ + \n\ + #### level 4 header\n\ + \n\ + Yet another paragraph\n"; + + assert_eq!( + parse_help_section("after section", input), + "This is some section\n\n\ + ### level 3 header\n\n\ + Additional text under the section.\n\n\ + #### level 4 header\n\n\ + Yet another paragraph" + ); + } + #[test] #[should_panic] fn section_parsing_panic() {