From cb1e253b22ff3c5641185eb12d637b22fc587ed6 Mon Sep 17 00:00:00 2001 From: Leynos Date: Thu, 17 Jul 2025 01:06:38 +0100 Subject: [PATCH 1/3] Add regression test for long inline code in list item --- tests/integration.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index fce5c95b..de4fc72d 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -715,6 +715,21 @@ fn test_wrap_multiple_inline_code_spans() { let output = process_stream(&input); common::assert_wrapped_list_item(&output, "- ", 2); } +#[test] +fn test_wrap_long_inline_code_item() { + let input = vec![ + concat!( + "- `async def on_unhandled(self, ws: WebSocketLike, message: Union[str, bytes])`:", + " A fallback handler for messages that are not dispatched by the more specific", + " message handlers. This can be used for raw text/binary data or messages that", + " don't conform to the expected structured format." + ) + .to_string(), + ]; + let output = process_stream(&input); + common::assert_wrapped_list_item(&output, "- ", 4); + assert!(output.first().unwrap().ends_with("`:")); +} #[test] fn test_wrap_footnote_multiline() { From 20a548f02da2b71e30ac271c12755981ea1d047a Mon Sep 17 00:00:00 2001 From: Leynos Date: Thu, 17 Jul 2025 01:09:51 +0100 Subject: [PATCH 2/3] Use `expect` instead of `unwrap` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- tests/integration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration.rs b/tests/integration.rs index de4fc72d..303f95d0 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -728,7 +728,7 @@ fn test_wrap_long_inline_code_item() { ]; let output = process_stream(&input); common::assert_wrapped_list_item(&output, "- ", 4); - assert!(output.first().unwrap().ends_with("`:")); + assert!(output.first().expect("output should not be empty").ends_with("`:")); } #[test] From 1440c69b4c099fac5e6de4a509715e75f9502317 Mon Sep 17 00:00:00 2001 From: Leynos Date: Thu, 17 Jul 2025 01:13:02 +0100 Subject: [PATCH 3/3] Fix wrapping --- tests/integration.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration.rs b/tests/integration.rs index 303f95d0..97e90344 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -728,7 +728,12 @@ fn test_wrap_long_inline_code_item() { ]; let output = process_stream(&input); common::assert_wrapped_list_item(&output, "- ", 4); - assert!(output.first().expect("output should not be empty").ends_with("`:")); + assert!( + output + .first() + .expect("output should not be empty") + .ends_with("`:") + ); } #[test]