Skip to content

Commit

Permalink
also test if all desktop set emojis are counted as one emoji
Browse files Browse the repository at this point in the history
currently fails on region flags
  • Loading branch information
Simon-Laux committed Nov 16, 2023
1 parent 9f3ba6e commit 9ad873d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/emoji/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use deltachat_message_parser::parser::is_emoji::emoji;
use deltachat_message_parser::parser::is_emoji::{emoji, get_first_emoji, count_emojis_if_only_contains_emoji};

#[test]
fn test_all_desktop_emoji_picker_emojis() {
Expand All @@ -21,3 +21,29 @@ fn test_all_desktop_emoji_picker_emojis() {
"out of {total} cases {failed_count} failed"
);
}

#[test]
fn test_all_desktop_emoji_picker_emojis_are_single_emojis() {
let testcases = include_str!("./all_desktop_emojis.txt").split(',');
let mut total = 0;
let mut failed = vec![];
for case in testcases {
if count_emojis_if_only_contains_emoji(case) != Some(1) {
let result= get_first_emoji(case);
if result != Some(case) {
print!("{case}:\n{:?}\n{:?}\n", result.map(|r|r.chars()), case.chars());
failed.push(case);
}
}
total += 1;
}
let failed_count = failed.len();
if !failed.is_empty() {
println!("Failed Cases");
print!("{}", failed.join(", "));
}
assert_eq!(
failed_count, 0,
"out of {total} cases {failed_count} failed"
);
}

0 comments on commit 9ad873d

Please sign in to comment.