use panache::format;
#[test]
fn markdown_link_no_break() {
let cfg = panache::ConfigBuilder::default().line_width(30).build();
let input = "after this line comes a link \n";
let output = format(input, Some(cfg), None);
assert!(
!output.contains("!\n["),
"Image link should not be broken across lines"
);
assert!(
!output.contains("]\n("),
"Link text and URL should not be separated"
);
let cfg = panache::ConfigBuilder::default().line_width(25).build();
let input2 = "here is a regular [link text](https://example.com) in text\n";
let output2 = format(input2, Some(cfg), None);
assert!(
!output2.contains("]\n("),
"Link text and URL should not be separated"
);
assert!(output2.contains("https://example.com"));
}
#[test]
fn link_destination_title_single_quotes_normalized() {
let input = "A [link](https://example.com 'Title Here') in text.\n";
let output = format(input, None, None);
similar_asserts::assert_eq!(
output,
"A [link](https://example.com \"Title Here\") in text.\n"
);
}
#[test]
fn image_destination_title_single_quotes_normalized() {
let input = "An  in text.\n";
let output = format(input, None, None);
similar_asserts::assert_eq!(
output,
"An  in text.\n"
);
}