Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,4 +912,24 @@ 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() {
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(),
];
Comment thread
coderabbitai[bot] marked this conversation as resolved.
let wrapped = wrap_text(&input, 80);
let joined = wrapped.join("\n");
assert_eq!(joined.matches("https://").count(), 1);
assert!(
wrapped
.iter()
.any(|l| l.contains("https://falcon.readthedocs.io"))
);
}
}