use panache::format;
#[test]
fn smallcaps_basic() {
let input = "This is [small caps]{.smallcaps} text.\n";
let output = format(input, None, None);
assert_eq!(output, "This is [small caps]{.smallcaps} text.\n");
}
#[test]
fn underline_basic() {
let input = "This is [underlined]{.underline} text.\n";
let output = format(input, None, None);
assert_eq!(output, "This is [underlined]{.underline} text.\n");
}
#[test]
fn highlight_basic() {
let input = "This is [highlighted]{.mark} text.\n";
let output = format(input, None, None);
assert_eq!(output, "This is [highlighted]{.mark} text.\n");
}
#[test]
fn span_with_nested_emphasis() {
let input = "Text with [**bold** and *italic*]{.smallcaps} inside.\n";
let output = format(input, None, None);
assert_eq!(
output,
"Text with [**bold** and *italic*]{.smallcaps} inside.\n"
);
}
#[test]
fn span_with_code() {
let input = "A span with [`code`]{.highlight} in it.\n";
let output = format(input, None, None);
assert_eq!(output, "A span with [`code`]{.highlight} in it.\n");
}
#[test]
fn span_with_multiple_classes() {
let input = "Text with [multiple classes]{.smallcaps .underline .mark}.\n";
let output = format(input, None, None);
assert_eq!(
output,
"Text with [multiple classes]{.smallcaps .underline .mark}.\n"
);
}
#[test]
fn span_with_attributes() {
let input = "A span with [attributes]{.class key=\"value\"}.\n";
let output = format(input, None, None);
assert!(output.contains("[attributes]{.class key=\"value\"}"));
}
#[test]
fn span_with_id() {
let input = "A span with [an ID]{#myid .class}.\n";
let output = format(input, None, None);
assert_eq!(output, "A span with [an ID]{#myid .class}.\n");
}
#[test]
fn multiple_spans_in_line() {
let input = "Multiple [span one]{.smallcaps} and [span two]{.underline} here.\n";
let output = format(input, None, None);
assert_eq!(
output,
"Multiple [span one]{.smallcaps} and [span two]{.underline} here.\n"
);
}
#[test]
fn span_in_heading() {
let input = "# Heading with [Small Caps]{.smallcaps}\n";
let output = format(input, None, None);
assert_eq!(output, "# Heading with [Small Caps]{.smallcaps}\n");
}
#[test]
fn span_in_blockquote() {
let input = "> Quote with [small caps]{.smallcaps} text.\n";
let output = format(input, None, None);
assert_eq!(output, "> Quote with [small caps]{.smallcaps} text.\n");
}
#[test]
fn span_in_list() {
let input = "- Item with [small caps]{.smallcaps}\n";
let output = format(input, None, None);
assert_eq!(output, "- Item with [small caps]{.smallcaps}\n");
}
#[test]
fn span_across_wrapped_lines() {
let input = "This is a very long line with [some small caps text that might get wrapped]{.smallcaps} in it.\n";
let output = format(input, None, None);
assert!(output.contains("[some small caps text that might get wrapped]{.smallcaps}"));
}
#[test]
fn span_idempotency() {
let input = "Text with [small caps]{.smallcaps} and [underline]{.underline}.\n";
let output1 = format(input, None, None);
let output2 = format(&output1, None, None);
assert_eq!(output1, output2, "Formatting should be idempotent");
}
#[test]
fn complex_nested_span() {
let input = "Text with [**bold** and `code` and *emphasis*]{.smallcaps .highlight}.\n";
let output = format(input, None, None);
assert!(output.contains("[**bold** and `code` and *emphasis*]{.smallcaps .highlight}"));
}
#[test]
fn span_whitespace_normalization() {
let input = "Text with [content]{.class key=\"val\" foo=\"bar\"}.\n";
let output = format(input, None, None);
assert!(output.contains("{.class key=\"val\" foo=\"bar\"}"));
}