Skip to content

Commit

Permalink
Merge pull request #253 from github/tests-refresh
Browse files Browse the repository at this point in the history
Touch up emoji integrity tests
  • Loading branch information
mislav authored Nov 15, 2022
2 parents 9917299 + f7a6bb6 commit d04fd77
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/emoji_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@ class EmojiTest < TestCase
GENDER_EXCEPTIONS = [
"man_with_gua_pi_mao",
"woman_with_headscarf",
"pregnant_woman",
"isle_of_man",
"blonde_woman",
"blonde_woman", # blond_haired_man
/^couple(kiss)?_/,
/^family_/,
]

DASH_EXCEPTIONS = [
"-1",
"t-rex",
"e-mail",
"non-potable_water",
]

test "emojis have valid names" do
aliases = Emoji.all.flat_map(&:aliases)

Expand All @@ -75,7 +81,7 @@ class EmojiTest < TestCase
alias_count = Hash.new(0)
aliases.each do |name|
alias_count[name] += 1
invalid << name if name !~ /\A[\w+-]+\Z/
invalid << name if name !~ /\A[\w+]+\Z/ && !DASH_EXCEPTIONS.include?(name)
another_gender = to_another_gender.call(name)
gender_mismatch << another_gender unless aliases.include?(another_gender)
end
Expand All @@ -90,7 +96,6 @@ class EmojiTest < TestCase
test "missing or incorrect unicodes" do
emoji_map, _ = EmojiTestParser.parse(File.expand_path("../../vendor/unicode-emoji-test.txt", __FILE__))
source_unicode_emoji = emoji_map.values
supported_sequences = Emoji.all.flat_map(&:unicode_aliases)
text_glyphs = Emoji.const_get(:TEXT_GLYPHS)

missing = 0
Expand Down

0 comments on commit d04fd77

Please sign in to comment.