Expand test coverage

This commit is contained in:
Juno Takano 2026-01-10 05:42:36 -03:00
commit 5958f1551b
27 changed files with 593 additions and 109 deletions

View file

@ -207,6 +207,43 @@ mod tests {
);
}
#[test]
fn leading_multiword_anchor() {
assert_eq!(
read("interactions are |basic elements| of systems"),
r#"<p>interactions are <a href="/node/basic elements">basic elements</a> of systems</p>"#
);
}
#[test]
fn explicit_end_of_destination() {
assert_eq!(
read("interactions are |basic elements|BasicElements| of systems"),
r#"<p>interactions are <a href="/node/BasicElements">basic elements</a> of systems</p>"#
);
}
#[test]
fn explicit_end_of_external_destination() {
assert_eq!(
read("this |anchor example|https://example.com| is external"),
r#"<p>this <a href="https://example.com">anchor example</a> is external</p>"#
);
}
#[test]
fn anchor_destination_at_eoi() {
assert_eq!(read("a |b c|d"), r#"<p>a <a href="/node/d">b c</a></p>"#);
}
#[test]
fn external_anchor_destination_at_eoi() {
assert_eq!(
read("a b|https://example.com"),
r#"<p>a <a href="https://example.com">b</a></p>"#
);
}
#[test]
fn nonleading_plural_anchor_at_eoi() {
assert_eq!(