negarmoji 0.1.5 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +42 -60
- data/.rubocop.yml +6 -4
- data/Gemfile +0 -3
- data/Rakefile +0 -16
- data/db/filenames.json +3499 -0
- data/db/negarmoji.json +13011 -4886
- data/lib/negarmoji/character.rb +2 -1
- data/lib/negarmoji/emoji.rb +1 -1
- data/lib/negarmoji/version.rb +1 -1
- data/negarmoji.gemspec +7 -7
- data/script/dev_release.py +5 -3
- data/script/downloader.sh +29 -0
- data/script/filename_generator.rb +11 -0
- data/script/json_generator.py +163 -0
- data/script/test.sh +2 -2
- data/script/updater.py +30 -0
- data/test/emoji_test.rb +58 -59
- data/test/test_helper.rb +1 -0
- data/vendor/unicode-emoji-test.txt +2173 -2021
- metadata +21 -19
- data/db/dump.rb +0 -67
- data/db/index.html +0 -113
- data/script/bootstrap +0 -10
data/lib/negarmoji/character.rb
CHANGED
data/lib/negarmoji/emoji.rb
CHANGED
data/lib/negarmoji/version.rb
CHANGED
data/negarmoji.gemspec
CHANGED
@@ -20,12 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^test/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.required_ruby_version = ">= 2.
|
23
|
+
spec.required_ruby_version = ">= 2.7.2"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "~> 2.
|
26
|
-
spec.add_development_dependency "minitest", "~> 5.
|
27
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
28
|
-
spec.add_development_dependency "rspec", "~> 3.
|
29
|
-
spec.add_development_dependency "rubocop", "~>
|
30
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.2.3"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.14.4"
|
27
|
+
spec.add_development_dependency "rake", "~> 13.0.6"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
29
|
+
spec.add_development_dependency "rubocop", "~> 1.18.3"
|
30
|
+
spec.add_development_dependency "simplecov", "~> 0.21.2"
|
31
31
|
end
|
data/script/dev_release.py
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
import os
|
5
5
|
import subprocess
|
6
6
|
|
7
|
+
package_name = "AzadehAfzar Negareh Emoji Library"
|
8
|
+
|
7
9
|
# get path to this file's directory, then go one directory up.
|
8
10
|
file_path = os.path.abspath(os.path.dirname(__file__))
|
9
11
|
base_path = os.path.abspath(os.path.dirname(file_path))
|
@@ -34,7 +36,7 @@ for line in version_file:
|
|
34
36
|
if not version or not version_info:
|
35
37
|
raise ValueError("ERROR: version not found at version.rb.")
|
36
38
|
|
37
|
-
print("This program will tag a new release of
|
39
|
+
print(f"This program will tag a new release of {package_name}\n"
|
38
40
|
+ "and it will push to gitlab and github for building,\n"
|
39
41
|
+ "gitlab will push a built gem to rubygems.org.\n\n"
|
40
42
|
+ f"current version is {version}\n\n")
|
@@ -89,7 +91,7 @@ with open(version_file_path, "w+") as file:
|
|
89
91
|
# do git commit and tag and push to upstreams
|
90
92
|
print("Commit and Tag and Push to upstream. \n\n")
|
91
93
|
|
92
|
-
subprocess.call(f"git commit \"{version_file_path}\"
|
93
|
-
subprocess.call(f"git tag \"v{new_version}\"", shell=True)
|
94
|
+
subprocess.call(f"git commit \"{version_file_path}\" --sign --message \"version: {package_name} v{new_version}\"", shell=True)
|
95
|
+
subprocess.call(f"git tag --annotate --sign --message \"new {package_name} version {new_version}\" \"v{new_version}\"", shell=True)
|
94
96
|
subprocess.call(f"git push origin HEAD \"v{new_version}\"", shell=True)
|
95
97
|
subprocess.call(f"git push github HEAD \"v{new_version}\"", shell=True)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# path variables.
|
4
|
+
VENDORDIR="${PWD%/*}"/vendor
|
5
|
+
TEMPDIR="temp"
|
6
|
+
|
7
|
+
# download links.
|
8
|
+
OPENMOJI_JSON_LINK="https://raw.githubusercontent.com/hfg-gmuend/openmoji/master/data/openmoji.json"
|
9
|
+
GEMOJI_JSON_LINK="https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
|
10
|
+
GEMOJI_TEST_JSON_LINK="https://raw.githubusercontent.com/github/gemoji/master/vendor/unicode-emoji-test.txt"
|
11
|
+
|
12
|
+
# setup paths.
|
13
|
+
OPENMOJI_JSON="${TEMPDIR}/openmoji.json"
|
14
|
+
GEMOJI_JSON="${TEMPDIR}/gemoji.json"
|
15
|
+
GEMOJI_TEST_JSON="${VENDORDIR}/unicode-emoji-test.txt"
|
16
|
+
|
17
|
+
# create temporary directory for files.
|
18
|
+
mkdir --parents "${TEMPDIR}"
|
19
|
+
|
20
|
+
# download gemoji and openmoji json files.
|
21
|
+
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 \
|
22
|
+
--tries 0 --no-dns-cache --output-document "${OPENMOJI_JSON}" "${OPENMOJI_JSON_LINK}"
|
23
|
+
|
24
|
+
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 \
|
25
|
+
--tries 0 --no-dns-cache --output-document "${GEMOJI_JSON}" "${GEMOJI_JSON_LINK}"
|
26
|
+
|
27
|
+
# download latest unicode emoji test from gemoji.
|
28
|
+
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 \
|
29
|
+
--tries 0 --no-dns-cache --output-document "${GEMOJI_TEST_JSON}" "${GEMOJI_TEST_JSON_LINK}"
|
@@ -0,0 +1,163 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
|
3
|
+
# Python Standard Library
|
4
|
+
import json
|
5
|
+
import codecs
|
6
|
+
import copy
|
7
|
+
|
8
|
+
def handle_alias_special_case(alias):
|
9
|
+
# special aliases causing duplication problems.
|
10
|
+
special_cases = [
|
11
|
+
"pretzel",
|
12
|
+
"sunglasses",
|
13
|
+
"pouting_face",
|
14
|
+
"kiss",
|
15
|
+
"horse",
|
16
|
+
"camel",
|
17
|
+
"post_office",
|
18
|
+
"satellite",
|
19
|
+
"umbrella",
|
20
|
+
"snowman",
|
21
|
+
"calendar"
|
22
|
+
]
|
23
|
+
|
24
|
+
if alias in special_cases:
|
25
|
+
alias = list(alias)
|
26
|
+
alias.append("2")
|
27
|
+
alias = "".join(alias)
|
28
|
+
return alias
|
29
|
+
elif alias == "flag_åland_islands":
|
30
|
+
return "flag_aland_islands"
|
31
|
+
else:
|
32
|
+
return alias
|
33
|
+
|
34
|
+
def create_alias(annotation, category):
|
35
|
+
"""Create alias from annotation."""
|
36
|
+
# clean annotation from bad characters.
|
37
|
+
alias = annotation.strip()
|
38
|
+
alias = alias.replace("&", "")
|
39
|
+
alias = alias.replace("!", "")
|
40
|
+
alias = alias.replace("(", "")
|
41
|
+
alias = alias.replace(")", "")
|
42
|
+
alias = alias.replace("“", "")
|
43
|
+
alias = alias.replace("”", "")
|
44
|
+
alias = alias.replace("’", "")
|
45
|
+
alias = alias.replace("#", "hashtag")
|
46
|
+
alias = alias.replace("*", "astrix")
|
47
|
+
alias = alias.replace("ä", "a")
|
48
|
+
alias = alias.replace("ã", "a")
|
49
|
+
# doesn't remove flag_åland_islands :|
|
50
|
+
alias = alias.replace("å", "a")
|
51
|
+
alias = alias.replace("ç", "c")
|
52
|
+
alias = alias.replace("é", "e")
|
53
|
+
alias = alias.replace("ô", "o")
|
54
|
+
alias = alias.replace("í", "i")
|
55
|
+
alias = alias.replace("ñ", "n")
|
56
|
+
alias = alias.replace("ü", "u")
|
57
|
+
alias = alias.replace(" ", "_")
|
58
|
+
alias = alias.replace("-", "_")
|
59
|
+
alias = alias.replace(".", "_")
|
60
|
+
alias = alias.replace(":", "_")
|
61
|
+
alias = alias.replace(",", "_")
|
62
|
+
alias = alias.replace("__", "_")
|
63
|
+
# handle openmoji extra emojis.
|
64
|
+
if category == "Extras & Openmoji":
|
65
|
+
alias = list(alias)
|
66
|
+
alias.append("_extra")
|
67
|
+
alias = "".join(alias)
|
68
|
+
# lowercase characters.
|
69
|
+
alias = alias.lower()
|
70
|
+
return handle_alias_special_case(alias)
|
71
|
+
|
72
|
+
def create_new_emoji(emoji, description, category, aliases, tags, unicode_version):
|
73
|
+
"""base structure for a emoji dictionary."""
|
74
|
+
new_dict = {
|
75
|
+
"emoji": emoji
|
76
|
+
, "description": description
|
77
|
+
, "category": category
|
78
|
+
, "aliases": [
|
79
|
+
aliases
|
80
|
+
]
|
81
|
+
, "tags": [
|
82
|
+
tags
|
83
|
+
]
|
84
|
+
, "unicode_version": f"{unicode_version}.0" if unicode_version is not None else ""
|
85
|
+
, "ios_version": f"{unicode_version}.0" if unicode_version is not None else ""
|
86
|
+
}
|
87
|
+
return new_dict
|
88
|
+
|
89
|
+
def generate_negarmoji_json(gemoji_json_file, openmoji_json_file, output_file_path):
|
90
|
+
"""Generate negarmoji json from combining openmoji json and gemoji json."""
|
91
|
+
|
92
|
+
# read in gemoji and openmoji json files.
|
93
|
+
with open(gemoji_json_file, "rb") as read_file:
|
94
|
+
gemoji = json.load(read_file)
|
95
|
+
with open(openmoji_json_file, "rb") as read_file:
|
96
|
+
openmoji = json.load(read_file)
|
97
|
+
|
98
|
+
# collect emojis from emoji dictionaries.
|
99
|
+
gemoji_emojis = set([emoji_dict["emoji"] for emoji_dict in gemoji])
|
100
|
+
openmoji_emojis = set([emoji_dict["emoji"] for emoji_dict in openmoji])
|
101
|
+
|
102
|
+
# some emojis are same in both gemoji and openmoji emojis but they differ in
|
103
|
+
# the end sequence, openmoji usually have an extra \ufe0f character, so in
|
104
|
+
# this part of code I'm trying to normalize gemoji dictionary by appending
|
105
|
+
# \ufe0f to the end of some emojis which results in a same emoji in
|
106
|
+
# the openmoji dictionary.
|
107
|
+
|
108
|
+
# find emojis in gemoji which will be same with an emoji in openmoji if we
|
109
|
+
# add \ufe0f at the end of it.
|
110
|
+
difference = [
|
111
|
+
(emoji.replace("\ufe0f", ""), emoji)
|
112
|
+
for emoji in openmoji_emojis
|
113
|
+
if emoji.replace("\ufe0f", "") in gemoji_emojis
|
114
|
+
]
|
115
|
+
|
116
|
+
# normalize gemoji dictionary by replacing emojis.
|
117
|
+
for emoji_dict in gemoji:
|
118
|
+
for diff in difference:
|
119
|
+
if emoji_dict["emoji"] == diff[0]:
|
120
|
+
emoji_dict["emoji"] = diff[1]
|
121
|
+
break
|
122
|
+
|
123
|
+
# re-create gemoji emojis from normalized gemoji dictionary.
|
124
|
+
gemoji_emojis = set([emoji_dict["emoji"] for emoji_dict in gemoji])
|
125
|
+
|
126
|
+
# find difference between openmoji and gemoji. since we have normalized
|
127
|
+
# gemoji, in this stage only unique new emojis from openmoji will show up
|
128
|
+
# and not the same emojis with and extra \ufe0f at the end of it.
|
129
|
+
difference = openmoji_emojis - gemoji_emojis
|
130
|
+
|
131
|
+
# create base negarmoji dictionary from gemoji.
|
132
|
+
negarmoji = copy.deepcopy(gemoji)
|
133
|
+
|
134
|
+
# convert new unique emojis from openmoji dictionary type to negarmoji dictionary
|
135
|
+
for emoji_dict in openmoji:
|
136
|
+
if emoji_dict["emoji"] in difference:
|
137
|
+
# filter properties.
|
138
|
+
emoji = emoji_dict["emoji"]
|
139
|
+
description = emoji_dict["annotation"]
|
140
|
+
category = emoji_dict["group"].replace("-", " & ").title()
|
141
|
+
aliases = create_alias(emoji_dict["annotation"], category)
|
142
|
+
tags = emoji_dict["tags"]
|
143
|
+
unicode_version = emoji_dict["unicode"]
|
144
|
+
# create emoji dictionary.
|
145
|
+
new_emoji_dict = create_new_emoji(emoji, description, category, aliases, tags, unicode_version)
|
146
|
+
# add new dictionary to negarmoji dictionary.
|
147
|
+
negarmoji.append(new_emoji_dict)
|
148
|
+
|
149
|
+
# add extra aliases for emojis from openmoji annotations.
|
150
|
+
for emoji_dict in negarmoji:
|
151
|
+
for emoji_dict_2 in openmoji:
|
152
|
+
if emoji_dict["emoji"] == emoji_dict_2["emoji"]:
|
153
|
+
new_alias = create_alias(emoji_dict_2["annotation"], emoji_dict_2["group"].replace("-", " & ").title())
|
154
|
+
if new_alias not in emoji_dict["aliases"]:
|
155
|
+
check_duplicate = list(new_alias)
|
156
|
+
check_duplicate.append("2")
|
157
|
+
check_duplicate = "".join(check_duplicate)
|
158
|
+
if check_duplicate not in emoji_dict["aliases"]:
|
159
|
+
emoji_dict["aliases"].append(new_alias)
|
160
|
+
break
|
161
|
+
|
162
|
+
with codecs.open(output_file_path, "w", encoding="utf8") as write_file:
|
163
|
+
json.dump(negarmoji, write_file, ensure_ascii=False, indent=4)
|
data/script/test.sh
CHANGED
data/script/updater.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
|
3
|
+
# Python Standard Library
|
4
|
+
import os
|
5
|
+
import glob
|
6
|
+
import subprocess
|
7
|
+
|
8
|
+
# Custom modules
|
9
|
+
from json_generator import generate_negarmoji_json
|
10
|
+
|
11
|
+
# configure path variables.
|
12
|
+
file_path = os.path.abspath(os.path.dirname(__file__))
|
13
|
+
base_path = os.path.abspath(os.path.dirname(file_path))
|
14
|
+
temp_path = os.path.join(file_path, "temp")
|
15
|
+
gemoji_json_file = os.path.join(temp_path, "gemoji.json")
|
16
|
+
openmoji_json_file = os.path.join(temp_path, "openmoji.json")
|
17
|
+
negarmoji_json_file = os.path.join(base_path, "db", "negarmoji.json")
|
18
|
+
filenames_json_file = os.path.join(base_path, "db", "filenames.json")
|
19
|
+
|
20
|
+
# download latest files from gemoji and openmoji repositories.
|
21
|
+
process = subprocess.run(["./downloader.sh"], stdout=subprocess.PIPE)
|
22
|
+
|
23
|
+
# generate negarmoji json.
|
24
|
+
generate_negarmoji_json(gemoji_json_file, openmoji_json_file, negarmoji_json_file)
|
25
|
+
|
26
|
+
# generate emoji filenames json.
|
27
|
+
process = subprocess.run(["./filename_generator.rb", f"{filenames_json_file}"], stdout=subprocess.PIPE)
|
28
|
+
|
29
|
+
# delete temp folder.
|
30
|
+
process = subprocess.run(["rm", "-rf", f"{temp_path}"], stdout=subprocess.PIPE)
|
data/test/emoji_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
1
|
+
require 'test_helper'
|
2
|
+
require_relative '../db/emoji-test-parser'
|
3
3
|
|
4
4
|
class EmojiTest < TestCase
|
5
|
-
test "fetching all
|
5
|
+
test "fetching all emoji" do
|
6
6
|
count = Emoji.all.size
|
7
7
|
assert count > 845, "there were too few emojis: #{count}"
|
8
8
|
end
|
@@ -13,26 +13,26 @@ class EmojiTest < TestCase
|
|
13
13
|
assert count > min_size, "there were too few unicode mappings: #{count}"
|
14
14
|
end
|
15
15
|
|
16
|
-
test "finding
|
17
|
-
assert_equal
|
16
|
+
test "finding emoji by alias" do
|
17
|
+
assert_equal 'smile', Emoji.find_by_alias('smile').name
|
18
18
|
end
|
19
19
|
|
20
|
-
test "finding nonexistent
|
21
|
-
assert_nil Emoji.find_by_alias(
|
20
|
+
test "finding nonexistent emoji by alias returns nil" do
|
21
|
+
assert_nil Emoji.find_by_alias('$$$')
|
22
22
|
end
|
23
23
|
|
24
|
-
test "finding
|
24
|
+
test "finding emoji by unicode" do
|
25
25
|
emoji = Emoji.find_by_unicode("\u{1f604}") # grinning face with smiling eyes
|
26
26
|
assert_equal "\u{1f604}", emoji.raw
|
27
27
|
end
|
28
28
|
|
29
|
-
test "finding nonexistent
|
29
|
+
test "finding nonexistent emoji by unicode returns nil" do
|
30
30
|
assert_nil Emoji.find_by_unicode("\u{1234}")
|
31
31
|
end
|
32
32
|
|
33
33
|
test "unicode_aliases" do
|
34
34
|
emoji = Emoji.find_by_unicode("\u{2728}") # sparkles
|
35
|
-
assert_equal
|
35
|
+
assert_equal ["2728", "2728-fe0f"], emoji.unicode_aliases.map { |u| Emoji::Character.hex_inspect(u) }
|
36
36
|
end
|
37
37
|
|
38
38
|
test "unicode_aliases doesn't necessarily include form without VARIATION_SELECTOR_16" do
|
@@ -41,22 +41,21 @@ class EmojiTest < TestCase
|
|
41
41
|
end
|
42
42
|
|
43
43
|
test "emojis have tags" do
|
44
|
-
emoji = Emoji.find_by_alias(
|
45
|
-
assert emoji.tags.include?(
|
46
|
-
assert emoji.tags.include?(
|
47
|
-
assert emoji.tags.include?(
|
44
|
+
emoji = Emoji.find_by_alias('smile')
|
45
|
+
assert emoji.tags.include?('happy')
|
46
|
+
assert emoji.tags.include?('joy')
|
47
|
+
assert emoji.tags.include?('pleased')
|
48
48
|
end
|
49
49
|
|
50
50
|
GENDER_EXCEPTIONS = [
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
].freeze
|
51
|
+
"man_with_gua_pi_mao",
|
52
|
+
"woman_with_headscarf",
|
53
|
+
"pregnant_woman",
|
54
|
+
"isle_of_man",
|
55
|
+
"blonde_woman",
|
56
|
+
/^couple(kiss)?_/,
|
57
|
+
/^family_/,
|
58
|
+
]
|
60
59
|
|
61
60
|
test "emojis have valid names" do
|
62
61
|
aliases = Emoji.all.flat_map(&:aliases)
|
@@ -65,17 +64,17 @@ class EmojiTest < TestCase
|
|
65
64
|
alias_count = Hash.new(0)
|
66
65
|
aliases.each do |name|
|
67
66
|
alias_count[name] += 1
|
68
|
-
invalid << name if name !~
|
67
|
+
invalid << name if name !~ /\A[\w+-]+\Z/
|
69
68
|
end
|
70
69
|
|
71
70
|
duplicates = alias_count.select { |_, count| count > 1 }.keys
|
72
71
|
|
73
|
-
assert_equal [], invalid, "some
|
74
|
-
assert_equal [], duplicates, "some
|
72
|
+
assert_equal [], invalid, "some emoji have invalid names"
|
73
|
+
assert_equal [], duplicates, "some emoji aliases have duplicates"
|
75
74
|
end
|
76
75
|
|
77
76
|
test "missing or incorrect unicodes" do
|
78
|
-
emoji_map, = EmojiTestParser.parse(File.expand_path("
|
77
|
+
emoji_map, _ = EmojiTestParser.parse(File.expand_path("../../vendor/unicode-emoji-test.txt", __FILE__))
|
79
78
|
source_unicode_emoji = emoji_map.values
|
80
79
|
supported_sequences = Emoji.all.flat_map(&:unicode_aliases)
|
81
80
|
text_glyphs = Emoji.const_get(:TEXT_GLYPHS)
|
@@ -85,10 +84,9 @@ class EmojiTest < TestCase
|
|
85
84
|
source_unicode_emoji.each do |emoji|
|
86
85
|
emoji[:sequences].each do |raw|
|
87
86
|
next if text_glyphs.include?(raw) || Emoji.find_by_unicode(raw)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
message << format(" - could be %s (:%s:)", found.hex_inspect, found.name)
|
87
|
+
message << "%s (%s)" % [Emoji::Character.hex_inspect(raw), emoji[:description]]
|
88
|
+
if found = Emoji.find_by_unicode(raw.gsub("\u{fe0f}", ""))
|
89
|
+
message << " - could be %s (:%s:)" % [found.hex_inspect, found.name]
|
92
90
|
end
|
93
91
|
message << "\n"
|
94
92
|
missing += 1
|
@@ -98,49 +96,49 @@ class EmojiTest < TestCase
|
|
98
96
|
assert_equal 0, missing, message
|
99
97
|
end
|
100
98
|
|
101
|
-
test "
|
99
|
+
test "emoji have category" do
|
102
100
|
missing = Emoji.all.select { |e| e.category.to_s.empty? }
|
103
|
-
assert_equal [], missing.map(&:name), "some
|
101
|
+
assert_equal [], missing.map(&:name), "some emoji don't have a category"
|
104
102
|
|
105
|
-
emoji = Emoji.find_by_alias(
|
106
|
-
assert_equal
|
103
|
+
emoji = Emoji.find_by_alias('family_man_woman_girl')
|
104
|
+
assert_equal 'People & Body', emoji.category
|
107
105
|
|
108
106
|
categories = Emoji.all.map(&:category).uniq.compact
|
109
107
|
assert_equal [
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
108
|
+
"Smileys & Emotion",
|
109
|
+
"People & Body",
|
110
|
+
"Animals & Nature",
|
111
|
+
"Food & Drink",
|
112
|
+
"Travel & Places",
|
113
|
+
"Activities",
|
114
|
+
"Objects",
|
115
|
+
"Symbols",
|
116
|
+
"Flags",
|
117
|
+
"Component",
|
118
|
+
"Extras & Openmoji",
|
119
|
+
"Extras & Unicode"
|
122
120
|
], categories
|
123
121
|
end
|
124
122
|
|
125
|
-
test "
|
123
|
+
test "emoji have description" do
|
126
124
|
missing = Emoji.all.select { |e| e.description.to_s.empty? }
|
127
|
-
assert_equal [], missing.map(&:name), "some
|
125
|
+
assert_equal [], missing.map(&:name), "some emoji don't have a description"
|
128
126
|
|
129
|
-
emoji = Emoji.find_by_alias(
|
130
|
-
assert_equal
|
127
|
+
emoji = Emoji.find_by_alias('family_man_woman_girl')
|
128
|
+
assert_equal 'family: man, woman, girl', emoji.description
|
131
129
|
end
|
132
130
|
|
133
|
-
test "
|
134
|
-
emoji = Emoji.find_by_alias(
|
135
|
-
assert_equal
|
131
|
+
test "emoji have Unicode version" do
|
132
|
+
emoji = Emoji.find_by_alias('family_man_woman_girl')
|
133
|
+
assert_equal '6.0', emoji.unicode_version
|
136
134
|
end
|
137
135
|
|
138
|
-
test "
|
136
|
+
test "emoji have iOS version" do
|
139
137
|
missing = Emoji.all.select { |e| e.ios_version.to_s.empty? }
|
140
|
-
assert_equal [], missing.map(&:name), "some
|
138
|
+
assert_equal [], missing.map(&:name), "some emoji don't have an iOS version"
|
141
139
|
|
142
|
-
emoji = Emoji.find_by_alias(
|
143
|
-
assert_equal
|
140
|
+
emoji = Emoji.find_by_alias('family_man_woman_girl')
|
141
|
+
assert_equal '8.3', emoji.ios_version
|
144
142
|
end
|
145
143
|
|
146
144
|
test "no custom emojis" do
|
@@ -207,11 +205,12 @@ class EmojiTest < TestCase
|
|
207
205
|
|
208
206
|
begin
|
209
207
|
assert_equal emoji, Emoji.find_by_alias("weary")
|
208
|
+
assert_equal emoji, Emoji.find_by_alias("weary_face")
|
210
209
|
assert_equal emoji, Emoji.find_by_alias("whining")
|
211
210
|
assert_equal emoji, Emoji.find_by_unicode("\u{1f629}")
|
212
211
|
assert_equal emoji, Emoji.find_by_unicode("\u{1f629}\u{266a}")
|
213
212
|
|
214
|
-
assert_equal %w[weary whining], emoji.aliases
|
213
|
+
assert_equal %w[weary weary_face whining], emoji.aliases
|
215
214
|
assert_includes emoji.tags, "complaining"
|
216
215
|
ensure
|
217
216
|
emoji.aliases.pop
|