Skip to content

Commit

Permalink
failing test for link titles with interior punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
max-heller committed Nov 23, 2023
1 parent b1f77e0 commit e891ea4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,32 @@ mod escapes {
);
}

#[test]
fn link_titles() {
// See https://spec.commonmark.org/0.30/#link-title for the rules around
// link titles and the characters they may contain
assert_eq!(
fmts(r#"[link](http://example.com "'link title'")"#).0,
r#"[link](http://example.com "'link title'")"#
);
assert_eq!(
fmts(r#"[link](http://example.com "\"link title\"")"#).0,
r#"[link](http://example.com "\"link title\"")"#
);
assert_eq!(
fmts(r#"[link](http://example.com '"link title"')"#).0,
r#"[link](http://example.com "\"link title\"")"#
);
assert_eq!(
fmts(r#"[link](http://example.com '\'link title\'')"#).0,
r#"[link](http://example.com "'link title'")"#
);
assert_eq!(
fmts(r#"[link](http://example.com (\(link title\)))"#).0,
r#"[link](http://example.com "(link title)")"#
);
}

#[test]
fn it_does_esscape_lone_square_brackets_in_text() {
assert_eq!(
Expand Down

0 comments on commit e891ea4

Please sign in to comment.