-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't consume/eat the the exlaimation mark at the end of a link (#85)
* Don't consume/eat the the exlaimation mark at the end of a link closes #81 * add changelog entry
- Loading branch information
1 parent
6103181
commit 6c259a4
Showing
6 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
tests/based_on_issue/exclamation_mark_at_end_of_link_81.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
use deltachat_message_parser::parser::Element::*; | ||
use deltachat_message_parser::parser::{parse_desktop_set, parse_markdown_text, parse_only_text}; | ||
|
||
use crate::text_to_ast::https_link_no_puny; | ||
|
||
/// don't eat/consume the ! at the end of a link | ||
/// as disscussed in https://github.com/deltachat/message-parser/issues/81 | ||
#[test] | ||
fn text_only() { | ||
assert_eq!( | ||
parse_only_text("This is an my site: https://delta.chat!"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat", "delta.chat",) | ||
}, | ||
Text("!") | ||
] | ||
); | ||
assert_eq!( | ||
parse_only_text("This is an my site: https://delta.chat#!test"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat#!test", "delta.chat",) | ||
} | ||
] | ||
); | ||
} | ||
|
||
#[test] | ||
fn desktop_set() { | ||
assert_eq!( | ||
parse_desktop_set("This is an my site: https://delta.chat!"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat", "delta.chat",) | ||
}, | ||
Text("!") | ||
] | ||
); | ||
} | ||
|
||
#[test] | ||
fn desktop_set_negative() { | ||
assert_eq!( | ||
parse_desktop_set("This is an my site: https://delta.chat#!test"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat#!test", "delta.chat",) | ||
} | ||
] | ||
); | ||
} | ||
|
||
#[test] | ||
fn markdown() { | ||
assert_eq!( | ||
parse_markdown_text("This is an my site: https://delta.chat!"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat", "delta.chat",) | ||
}, | ||
Text("!") | ||
] | ||
); | ||
} | ||
#[test] | ||
fn markdown_negative() { | ||
assert_eq!( | ||
parse_markdown_text("This is an my site: https://delta.chat#!test"), | ||
vec![ | ||
Text("This is an my site: "), | ||
Link { | ||
destination: https_link_no_puny("https://delta.chat#!test", "delta.chat",) | ||
} | ||
] | ||
); | ||
} | ||
|
||
#[test] | ||
fn still_take_whole_link_in_labled_links() { | ||
assert_eq!( | ||
parse_markdown_text("This is an my [site](https://delta.chat/!)"), | ||
vec![ | ||
Text("This is an my "), | ||
LabeledLink { | ||
label: vec![Text("site")], | ||
destination: https_link_no_puny("https://delta.chat/!", "delta.chat",) | ||
} | ||
] | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod exclamation_mark_at_end_of_link_81; | ||
pub mod fediverse_handle_82; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters