Skip to content

Commit

Permalink
more tests (this time about ending chars)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Laux committed Oct 31, 2023
1 parent 57f2e5b commit 1ffcd71
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/text_to_ast/text_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,56 @@ fn link_special_chars_in_location_part() {
}
}

#[test]
fn link_stop_at_ending_char() {
let endings = vec![
"\"",
"'",
"''",
"\n\n",
];

for end_case in &endings {
let test_case = format!("https://delta.chat/delta{end_case}");
println!("testing {}", test_case);
let mut parsed_ending = parse_only_text(end_case);
let mut result = vec![Link {
destination: link_destination_for_testing("https://delta.chat/delta")
}];
result.append(&mut parsed_ending);
assert_eq!(
parse_only_text(&test_case),
result
);
}
}

#[test]
fn link_stop_at_ending_char_with_space() {
let endings = vec![
"\" ",
"' ",
"'' ",
"\n\n ",
" ",
": "
];

for end_case in &endings {
let test_case = format!("https://delta.chat/delta{end_case}");
println!("testing {}", test_case);
let mut parsed_ending = parse_only_text(end_case);
let mut result = vec![Link {
destination: link_destination_for_testing("https://delta.chat/delta")
}];
result.append(&mut parsed_ending);
assert_eq!(
parse_only_text(&test_case),
result
);
}
}


#[test]
fn test_link_example() {
Expand Down

0 comments on commit 1ffcd71

Please sign in to comment.