From 9bedda9d629a7a36d98ad1a15885255f2452cfc4 Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 16 Jul 2025 22:44:28 +0100 Subject: [PATCH 1/4] Add test for URL wrapping --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2fa12b6b..a4ec99a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -912,4 +912,22 @@ mod tests { vec!["This has a `dangling".to_string(), "code span.".to_string()] ); } + + #[test] + fn wrap_text_preserves_links() { + let input = vec![ + "`falcon-pachinko` is an extension library for the".to_string(), + "[Falcon](https://falcon.readthedocs.io) web framework. It adds a structured" + .to_string(), + "approach to asynchronous WebSocket routing and background worker integration." + .to_string(), + ]; + let wrapped = wrap_text(&input, 80); + assert_eq!(wrapped.iter().filter(|l| l.contains("https://")).count(), 1); + assert!( + wrapped + .iter() + .any(|l| l.contains("https://falcon.readthedocs.io")) + ); + } } From ef78fc472cd8c5b2a3ef86e4d159f64016729fcf Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 16 Jul 2025 23:00:36 +0100 Subject: [PATCH 2/4] Refine link wrapping test --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a4ec99a5..1ad8f106 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -912,6 +912,7 @@ mod tests { vec!["This has a `dangling".to_string(), "code span.".to_string()] ); } + // Regression: issue #76 – wrapping must keep inline links intact #[test] fn wrap_text_preserves_links() { @@ -923,7 +924,8 @@ mod tests { .to_string(), ]; let wrapped = wrap_text(&input, 80); - assert_eq!(wrapped.iter().filter(|l| l.contains("https://")).count(), 1); + let joined = wrapped.join("\n"); + assert_eq!(joined.matches("https://").count(), 1); assert!( wrapped .iter() From d9658a70cfcef0cc39beb9c9456d2a9a98576b4c Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 16 Jul 2025 23:03:52 +0100 Subject: [PATCH 3/4] Fix doc comment --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1ad8f106..a5796403 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -912,8 +912,8 @@ mod tests { vec!["This has a `dangling".to_string(), "code span.".to_string()] ); } - // Regression: issue #76 – wrapping must keep inline links intact - + + /// Validate that URLs are not broken by re-wrapping paragraphs containing hyperlinks. #[test] fn wrap_text_preserves_links() { let input = vec![ From 92cab4a57ba4140d7f184b600b7a0252308a348f Mon Sep 17 00:00:00 2001 From: Leynos Date: Wed, 16 Jul 2025 23:05:04 +0100 Subject: [PATCH 4/4] Remove extra spaces --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a5796403..f5d80646 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -912,7 +912,7 @@ mod tests { vec!["This has a `dangling".to_string(), "code span.".to_string()] ); } - + /// Validate that URLs are not broken by re-wrapping paragraphs containing hyperlinks. #[test] fn wrap_text_preserves_links() {