Skip to content

Commit

Permalink
add a test for is_quote_headline()
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Nov 11, 2024
1 parent a9b71af commit 302acb2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,28 @@ mod tests {
assert!(!is_plain_quote(""));
}

#[test]
fn test_is_quoted_headline() {
assert!(is_quoted_headline("On 2024-08-28, Bob wrote:"));
assert!(is_quoted_headline("Am 11. November 2024 schrieb Alice:"));
assert!(is_quoted_headline("Anonymous Longer Name a écrit:"));
assert!(is_quoted_headline("There is not really a pattern wrote:"));
assert!(is_quoted_headline(
"On Mon, 3 Jan, 2022 at 8:34 PM \"Anonymous Longer Name\" <[email protected]> wrote:"
));
assert!(!is_quoted_headline(
"How are you? I just want to say that this line does not belong to the quote!"
));
assert!(!is_quoted_headline(
"No quote headline as not ending with a colon"
));
assert!(!is_quoted_headline(
"Even though this ends with a colon, \
this is no quote-headline as just too long for most cases of date+name+address. \
it's all heuristics only, it is expected to go wrong sometimes. there is always the 'Show full message' button:"
));
}

#[test]
fn test_remove_top_quote() {
let (lines, top_quote) = remove_top_quote(&["> first", "> second"], true);
Expand Down

0 comments on commit 302acb2

Please sign in to comment.