use rstest::rstest;
use super::*;
#[test]
fn test_wrap_paragraph_with_link() {
let input = lines_vec to provide a familiar, ",
"declarative API for routing, extractors, and middleware."
)];
let output = process_stream(&input);
assert!(
output
.iter()
.any(|line| line.contains("[Actix Web](https://actix.rs/)")),
"link should not be broken across lines"
);
}
#[test]
fn test_wrap_paragraph_with_image_link() {
let input = lines_vec embedded in ",
"a sentence that should wrap without splitting the link."
)];
let output = process_stream(&input);
assert!(
output
.iter()
.any(|line| line.contains("")),
"image link should not be broken across lines",
);
}
#[test]
fn test_wrap_paragraph_with_nested_link() {
let input = lines_vec/guide) for details on",
" nightly features and usage."
)];
let output = process_stream(&input);
assert!(
output
.iter()
.any(|line| line.contains("(https://example.com/rust(nightly)/guide)")),
"link with nested parentheses should remain intact",
);
}
#[test]
fn test_wrap_link_with_trailing_punctuation() {
let input = lines_vec.",
];
let output = process_stream(&input);
assert_eq!(output, input);
}
#[rstest]
#[case(".")]
#[case(",")]
#[case(";")]
#[case(":")]
#[case("!")]
#[case("?")]
#[case("...")]
fn test_wrap_link_with_various_trailing_punctuation(#[case] punct: &str) {
let input = lines_vec{}", punct)];
let output = process_stream(&input);
assert_eq!(output, input, "Failed for punctuation: {punct}");
}
#[test]
fn test_wrap_link_at_line_end() {
let input = lines_vec"];
let output = process_stream(&input);
assert_eq!(output, input);
}
#[test]
fn test_wrap_link_with_punctuation_in_text() {
let input = lines_vec"];
let output = process_stream(&input);
assert_eq!(output, input);
}
#[test]
fn test_wrap_link_with_punctuation_in_url() {
let input = lines_vec"];
let output = process_stream(&input);
assert_eq!(output, input);
}