Skip to content

Commit

Permalink
Disallow dashes in new emoji aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Nov 15, 2022
1 parent 5f3415f commit a8d55fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/emoji_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class EmojiTest < TestCase
/^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 @@ -74,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 Down

0 comments on commit a8d55fd

Please sign in to comment.