unicode-emoji 3.6.0 β 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +24 -1
- data/README.md +105 -63
- data/Rakefile +6 -2
- data/data/emoji.marshal.gz +0 -0
- data/data/generate_constants.rb +120 -46
- data/lib/unicode/emoji/constants.rb +18 -2
- data/lib/unicode/emoji/generated/regex.rb +1 -1
- data/lib/unicode/emoji/generated/regex_include_mqe.rb +8 -0
- data/lib/unicode/emoji/generated/regex_include_mqe_uqe.rb +8 -0
- data/lib/unicode/emoji/generated/regex_include_text.rb +1 -1
- data/lib/unicode/emoji/generated/regex_possible.rb +8 -0
- data/lib/unicode/emoji/generated/regex_text.rb +1 -1
- data/lib/unicode/emoji/generated/regex_valid.rb +1 -1
- data/lib/unicode/emoji/generated/regex_valid_include_text.rb +1 -1
- data/lib/unicode/emoji/generated/regex_well_formed.rb +1 -1
- data/lib/unicode/emoji/generated/regex_well_formed_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_basic.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_include_mqe.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_include_mqe_uqe.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_possible.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_valid.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_valid_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_well_formed.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_well_formed_include_text.rb +1 -1
- data/lib/unicode/emoji/lazy_constants.rb +37 -6
- data/lib/unicode/emoji/list.rb +13 -0
- data/lib/unicode/emoji.rb +38 -5
- data/spec/data/.keep +0 -0
- data/spec/data/emoji-test.txt +5331 -0
- data/spec/emoji_test_txt_spec.rb +181 -0
- data/spec/unicode_emoji_spec.rb +152 -5
- data/unicode-emoji.gemspec +3 -3
- metadata +20 -7
@@ -0,0 +1,181 @@
|
|
1
|
+
require_relative "../lib/unicode/emoji"
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "open-uri"
|
4
|
+
|
5
|
+
def iterate_emoji
|
6
|
+
EMOJI_TEST_FILE.scan(/^(?:# (?<sub>sub)?group: (?<group_name>.*)$)|(?:(?<codepoints>.+?)\s*; (?<qual_status>.+?)-?qualified )/) do
|
7
|
+
if $~[:codepoints]
|
8
|
+
yield $~[:codepoints].split.map{|e| e.to_i(16)}.pack("U*"), $~[:qual_status]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "emoji-test.txt" do
|
14
|
+
EMOJI_TEST_FILE = begin
|
15
|
+
emoji_test_path = File.join(__dir__, "data/emoji-test.txt")
|
16
|
+
if File.exist? emoji_test_path
|
17
|
+
file = File.read(emoji_test_path)
|
18
|
+
else
|
19
|
+
puts "Downloading emoji-test.txt from the consortium"
|
20
|
+
URI.open "https://www.unicode.org/Public/emoji/#{Unicode::Emoji::EMOJI_VERSION}/emoji-test.txt" do |f|
|
21
|
+
file = f.read
|
22
|
+
File.write(File.join(__dir__, "data/emoji-test.txt"), @file)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
file
|
27
|
+
end
|
28
|
+
|
29
|
+
# qual_status:
|
30
|
+
# - fully - fully-qualified emoji sequences
|
31
|
+
# - minimally - minimallyq-ualified emoji sequences (some VS16 missing, but not first one)
|
32
|
+
# - un - unqualified emoji sequences (some VS16 missing)
|
33
|
+
|
34
|
+
describe "REGEX" do
|
35
|
+
describe "detects fully-qualified emoji" do
|
36
|
+
iterate_emoji do |emoji, qual_status|
|
37
|
+
it(emoji) do
|
38
|
+
if qual_status == "fully"
|
39
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX]
|
40
|
+
else
|
41
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "REGEX_INCLUDE_TEXT" do
|
49
|
+
describe "detects fully-qualified emoji and (unqualified) singleton text emoji" do
|
50
|
+
iterate_emoji do |emoji, qual_status|
|
51
|
+
it(emoji) do
|
52
|
+
if qual_status == "fully" || qual_status == "un" && emoji.size <= 2
|
53
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_INCLUDE_TEXT]
|
54
|
+
else
|
55
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_INCLUDE_TEXT]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "REGEX_INCLUDE_MQE" do
|
63
|
+
describe "detects fully-qualified emoji and minimally-qualified emoji" do
|
64
|
+
iterate_emoji do |emoji, qual_status|
|
65
|
+
it(emoji) do
|
66
|
+
if qual_status == "fully" || qual_status == "minimally"
|
67
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_INCLUDE_MQE]
|
68
|
+
else
|
69
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_INCLUDE_MQE]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "REGEX_INCLUDE_MQE_UQE" do
|
77
|
+
describe "detects all emoji" do
|
78
|
+
iterate_emoji do |emoji, qual_status|
|
79
|
+
it(emoji) do
|
80
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_INCLUDE_MQE_UQE]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "REGEX_VALID" do
|
87
|
+
describe "detects fully-qualified, minimally-qualified emoji, and unqualified emoji with ZWJ" do
|
88
|
+
iterate_emoji do |emoji, qual_status|
|
89
|
+
it(emoji) do
|
90
|
+
if qual_status == "fully" || qual_status == "minimally" || qual_status == "un" && emoji.size >= 3
|
91
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_VALID]
|
92
|
+
else
|
93
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_VALID]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "REGEX_VALID_INCLUDE_TEXT" do
|
101
|
+
describe "detects all emoji" do
|
102
|
+
iterate_emoji do |emoji, qual_status|
|
103
|
+
it(emoji) do
|
104
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_VALID_INCLUDE_TEXT]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "REGEX_WELL_FORMED" do
|
111
|
+
describe "detects fully-qualified, minimally-qualified emoji, and unqualified emoji with ZWJ" do
|
112
|
+
iterate_emoji do |emoji, qual_status|
|
113
|
+
it(emoji) do
|
114
|
+
if qual_status == "fully" || qual_status == "minimally" || qual_status == "un" && emoji.size >= 3
|
115
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_WELL_FORMED]
|
116
|
+
else
|
117
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_WELL_FORMED]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "REGEX_WELL_FORMED_INCLUDE_TEXT" do
|
125
|
+
describe "detects all emoji" do
|
126
|
+
iterate_emoji do |emoji, qual_status|
|
127
|
+
it(emoji) do
|
128
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_WELL_FORMED_INCLUDE_TEXT]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "REGEX_POSSIBLE" do
|
135
|
+
describe "detects all emoji, except unqualified keycap sequences" do
|
136
|
+
# fixing test not regex, since implementation of this regex should match the one in the standard
|
137
|
+
unqualified_keycaps = Unicode::Emoji::EMOJI_KEYCAPS.map{|keycap|
|
138
|
+
[keycap, Unicode::Emoji::EMOJI_KEYCAP_SUFFIX].pack("U*")
|
139
|
+
}
|
140
|
+
|
141
|
+
iterate_emoji do |emoji, qual_status|
|
142
|
+
it(emoji) do
|
143
|
+
if !unqualified_keycaps.include?(emoji)
|
144
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_POSSIBLE]
|
145
|
+
else
|
146
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_POSSIBLE]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "REGEX_TEXT" do
|
154
|
+
describe "detects (unqualified) singleton text emoji" do
|
155
|
+
iterate_emoji do |emoji, qual_status|
|
156
|
+
it(emoji) do
|
157
|
+
# if qual_status == "un" && emoji =~ /^.[\u{FE0E 20E3}]?$/
|
158
|
+
if qual_status == "un" && emoji.size <= 2
|
159
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_TEXT]
|
160
|
+
else
|
161
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_TEXT]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "REGEX_BASIC" do
|
169
|
+
describe "detects (fully-qualified) singleton emoji" do
|
170
|
+
iterate_emoji do |emoji, qual_status|
|
171
|
+
it(emoji) do
|
172
|
+
if qual_status == "fully" && emoji =~ /^.\u{FE0F}?$/
|
173
|
+
assert_equal emoji, emoji[Unicode::Emoji::REGEX_BASIC]
|
174
|
+
else
|
175
|
+
refute_equal emoji, emoji[Unicode::Emoji::REGEX_BASIC]
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/spec/unicode_emoji_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require "minitest/autorun"
|
|
3
3
|
|
4
4
|
describe Unicode::Emoji do
|
5
5
|
describe ".properties" do
|
6
|
-
it "returns an Array
|
6
|
+
it "returns an Array of Emoji properties for given codepoint" do
|
7
7
|
assert_equal ["Emoji", "Emoji_Presentation", "Extended_Pictographic"], Unicode::Emoji.properties("π΄")
|
8
8
|
assert_equal ["Emoji", "Extended_Pictographic"], Unicode::Emoji.properties("β ")
|
9
9
|
end
|
10
10
|
|
11
|
-
it "returns nil
|
11
|
+
it "returns nil if codepoint has no Emoji prop" do
|
12
12
|
assert_nil Unicode::Emoji.properties("A")
|
13
13
|
end
|
14
14
|
end
|
@@ -92,6 +92,16 @@ describe Unicode::Emoji do
|
|
92
92
|
assert_equal "π€Ύπ½ββοΈ", $&
|
93
93
|
end
|
94
94
|
|
95
|
+
it "does not match MQE zwj sequences" do
|
96
|
+
"π€Ύπ½ββ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX
|
97
|
+
refute_equal `π€Ύπ½ββ`, $&
|
98
|
+
end
|
99
|
+
|
100
|
+
it "does not match UQE emoji" do
|
101
|
+
"πββοΈ man golfing, missing VS16" =~ Unicode::Emoji::REGEX
|
102
|
+
refute_equal `πββοΈ`, $&
|
103
|
+
end
|
104
|
+
|
95
105
|
it "does not match valid zwj sequences that are not recommended" do
|
96
106
|
"π€ βπ€’ vomiting cowboy" =~ Unicode::Emoji::REGEX
|
97
107
|
assert_equal "π€ ", $&
|
@@ -132,8 +142,6 @@ describe Unicode::Emoji do
|
|
132
142
|
assert_equal "πͺΎ", $&
|
133
143
|
end
|
134
144
|
|
135
|
-
|
136
|
-
|
137
145
|
# See gh#12 and https://github.com/matt17r/nw5k/commit/05a34d3c9211a23e5ae6853bb19fd2f224779ef4#diff-afb6f8bc3bae71b75743e00882a060863e2430cbe858ec9014e5956504dfc61cR2
|
138
146
|
it "matches family emoji correctly" do
|
139
147
|
["π¨βπ©βπ§βπ¦", "π¨βπ©βπ¦βπ¦", "π¨βπ©βπ§βπ§", "π¨βπ¨βπ§βπ¦", "π¨βπ¨βπ¦βπ¦", "π¨βπ¨βπ§βπ§", "π©βπ©βπ§βπ¦", "π©βπ©βπ¦βπ¦", "π©βπ©βπ§βπ§", "π¨βπ¦βπ¦", "π¨βπ§βπ¦", "π¨βπ§βπ§", "π©βπ¦βπ¦", "π©βπ§βπ¦", "π©βπ§βπ§"].each { |family|
|
@@ -142,6 +150,30 @@ describe Unicode::Emoji do
|
|
142
150
|
end
|
143
151
|
end
|
144
152
|
|
153
|
+
describe "REGEX_INCLUDE_MQE" do
|
154
|
+
it "matches MQE emoji" do
|
155
|
+
"π€Ύπ½ββ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE
|
156
|
+
assert_equal `π€Ύπ½ββ`, $&
|
157
|
+
end
|
158
|
+
|
159
|
+
it "does not match UQE emoji" do
|
160
|
+
"πββοΈ man golfing, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE
|
161
|
+
refute_equal `πββοΈ`, $&
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "REGEX_INCLUDE_MQE_UQE" do
|
166
|
+
it "matches MQE emoji" do
|
167
|
+
"π€Ύπ½ββ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE_UQE
|
168
|
+
assert_equal `π€Ύπ½ββ`, $&
|
169
|
+
end
|
170
|
+
|
171
|
+
it "matches UQE emoji" do
|
172
|
+
"πββοΈ man golfing, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE_UQE
|
173
|
+
assert_equal `πββοΈ`, $&
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
145
177
|
describe "REGEX_VALID" do
|
146
178
|
it "matches most singleton emoji codepoints" do
|
147
179
|
"π΄ sleeping face" =~ Unicode::Emoji::REGEX_VALID
|
@@ -216,6 +248,11 @@ describe Unicode::Emoji do
|
|
216
248
|
assert_equal "π΄σ §σ ’σ ‘σ §σ ’σ Ώ", $&
|
217
249
|
end
|
218
250
|
|
251
|
+
it "matches valid tag sequences (compressed one)" do
|
252
|
+
"π΄σ ¬σ Άσ °σ ΄σ ²σ Ώ lv042" =~ Unicode::Emoji::REGEX_VALID
|
253
|
+
assert_equal "π΄σ ¬σ Άσ °σ ΄σ ²σ Ώ", $&
|
254
|
+
end
|
255
|
+
|
219
256
|
it "does not match invalid tag sequences" do
|
220
257
|
"π΄σ §σ ’σ ‘σ ‘σ ‘σ Ώ GB AAA" =~ Unicode::Emoji::REGEX_VALID
|
221
258
|
assert_equal "π΄", $& # only base flag is matched
|
@@ -306,11 +343,21 @@ describe Unicode::Emoji do
|
|
306
343
|
assert_equal "π΄σ §σ ’σ ‘σ §σ ’σ Ώ", $&
|
307
344
|
end
|
308
345
|
|
309
|
-
it "
|
346
|
+
it "matches invalid base tag sequences" do
|
310
347
|
"π΄σ §σ ’σ ‘σ ‘σ ‘σ Ώ GB AAA" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
311
348
|
assert_equal "π΄σ §σ ’σ ‘σ ‘σ ‘σ Ώ", $&
|
312
349
|
end
|
313
350
|
|
351
|
+
it "does not match too long tag sequences (only black flag is matched)" do
|
352
|
+
"π΄σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ Ώ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
353
|
+
assert_equal "π΄", $&
|
354
|
+
end
|
355
|
+
|
356
|
+
it "does not match invalid tag sequences (only black flag is matched)" do
|
357
|
+
"π΄σ €σ Ώ $" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
358
|
+
assert_equal "π΄", $&
|
359
|
+
end
|
360
|
+
|
314
361
|
it "matches recommended zwj sequences" do
|
315
362
|
"π€Ύπ½ββοΈ woman playing handball: medium skin tone" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
316
363
|
assert_equal "π€Ύπ½ββοΈ", $&
|
@@ -322,6 +369,106 @@ describe Unicode::Emoji do
|
|
322
369
|
end
|
323
370
|
end
|
324
371
|
|
372
|
+
describe "REGEX_POSSIBLE" do
|
373
|
+
it "matches most singleton emoji codepoints" do
|
374
|
+
"π΄ sleeping face" =~ Unicode::Emoji::REGEX_POSSIBLE
|
375
|
+
assert_equal "π΄", $&
|
376
|
+
end
|
377
|
+
|
378
|
+
it "matches singleton emoji in combination with emoji variation selector" do
|
379
|
+
"π΄\u{FE0F} sleeping face" =~ Unicode::Emoji::REGEX_POSSIBLE
|
380
|
+
assert_equal "π΄\u{FE0F}", $&
|
381
|
+
end
|
382
|
+
|
383
|
+
it "matches singleton emoji (without VS) when in combination with text variation selector" do
|
384
|
+
"π΄\u{FE0E} sleeping face" =~ Unicode::Emoji::REGEX_POSSIBLE
|
385
|
+
assert_equal "π΄", $&
|
386
|
+
end
|
387
|
+
|
388
|
+
it "matches textual singleton emoji" do
|
389
|
+
"βΆ play button" =~ Unicode::Emoji::REGEX_POSSIBLE
|
390
|
+
assert_equal "βΆ", $&
|
391
|
+
end
|
392
|
+
|
393
|
+
it "matches textual singleton emoji in combination with emoji variation selector" do
|
394
|
+
"βΆ\u{FE0F} play button" =~ Unicode::Emoji::REGEX_POSSIBLE
|
395
|
+
assert_equal "βΆ\u{FE0F}", $&
|
396
|
+
end
|
397
|
+
|
398
|
+
it "matches singleton 'component' emoji codepoints" do
|
399
|
+
"π» light skin tone" =~ Unicode::Emoji::REGEX_POSSIBLE
|
400
|
+
assert_equal "π»", $&
|
401
|
+
end
|
402
|
+
|
403
|
+
it "matches modified emoji if modifier base emoji is used" do
|
404
|
+
"ππ½ person in bed: medium skin tone" =~ Unicode::Emoji::REGEX_POSSIBLE
|
405
|
+
assert_equal "ππ½", $&
|
406
|
+
end
|
407
|
+
|
408
|
+
it "matches modified emoji even if no modifier base emoji is used" do
|
409
|
+
"π΅π½ cactus" =~ Unicode::Emoji::REGEX_POSSIBLE
|
410
|
+
assert_equal "π΅π½", $&
|
411
|
+
end
|
412
|
+
|
413
|
+
it "matches valid region flags" do
|
414
|
+
"π΅πΉ Portugal" =~ Unicode::Emoji::REGEX_POSSIBLE
|
415
|
+
assert_equal "π΅πΉ", $&
|
416
|
+
end
|
417
|
+
|
418
|
+
it "does match invalid region flags" do
|
419
|
+
"π΅π΅ PP Land" =~ Unicode::Emoji::REGEX_POSSIBLE
|
420
|
+
assert_equal "π΅π΅", $&
|
421
|
+
end
|
422
|
+
|
423
|
+
it "matches emoji keycap sequences" do
|
424
|
+
"2οΈβ£ keycap: 2" =~ Unicode::Emoji::REGEX_POSSIBLE
|
425
|
+
assert_equal "2οΈβ£", $&
|
426
|
+
end
|
427
|
+
|
428
|
+
it "matches only digit of non-emoji keycap sequences" do
|
429
|
+
"8β£ text keycap: 8" =~ Unicode::Emoji::REGEX_POSSIBLE
|
430
|
+
assert_equal "8", $&
|
431
|
+
|
432
|
+
"#β£ text keycap: #" =~ Unicode::Emoji::REGEX_POSSIBLE
|
433
|
+
assert_equal "#", $&
|
434
|
+
end
|
435
|
+
|
436
|
+
it "matches recommended tag sequences" do
|
437
|
+
"π΄σ §σ ’σ ³σ £σ ΄σ Ώ Scotland" =~ Unicode::Emoji::REGEX_POSSIBLE
|
438
|
+
assert_equal "π΄σ §σ ’σ ³σ £σ ΄σ Ώ", $&
|
439
|
+
end
|
440
|
+
|
441
|
+
it "matches valid tag sequences, even though they are not recommended" do
|
442
|
+
"π΄σ §σ ’σ ‘σ §σ ’σ Ώ GB AGB" =~ Unicode::Emoji::REGEX_POSSIBLE
|
443
|
+
assert_equal "π΄σ §σ ’σ ‘σ §σ ’σ Ώ", $&
|
444
|
+
end
|
445
|
+
|
446
|
+
it "matches invalid base tag sequences" do
|
447
|
+
"π΄σ §σ ’σ ‘σ ‘σ ‘σ Ώ GB AAA" =~ Unicode::Emoji::REGEX_POSSIBLE
|
448
|
+
assert_equal "π΄σ §σ ’σ ‘σ ‘σ ‘σ Ώ", $&
|
449
|
+
end
|
450
|
+
|
451
|
+
it "matches too long tag sequences" do
|
452
|
+
"π΄σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ Ώ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" =~ Unicode::Emoji::REGEX_POSSIBLE
|
453
|
+
assert_equal "π΄σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ σ Ώ", $&
|
454
|
+
end
|
455
|
+
|
456
|
+
it "machtes invalid tag sequences (only black flag is matched)" do
|
457
|
+
"π΄σ €σ Ώ $" =~ Unicode::Emoji::REGEX_POSSIBLE
|
458
|
+
assert_equal "π΄σ €σ Ώ", $&
|
459
|
+
end
|
460
|
+
|
461
|
+
it "matches recommended zwj sequences" do
|
462
|
+
"π€Ύπ½ββοΈ woman playing handball: medium skin tone" =~ Unicode::Emoji::REGEX_POSSIBLE
|
463
|
+
assert_equal "π€Ύπ½ββοΈ", $&
|
464
|
+
end
|
465
|
+
|
466
|
+
it "matches valid zwj sequences, even though they are not recommended" do
|
467
|
+
"π€ βπ€’ vomiting cowboy" =~ Unicode::Emoji::REGEX_POSSIBLE
|
468
|
+
assert_equal "π€ βπ€’", $&
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
325
472
|
describe "REGEX_BASIC" do
|
326
473
|
it "matches most singleton emoji codepoints" do
|
327
474
|
"π΄ sleeping face" =~ Unicode::Emoji::REGEX_BASIC
|
data/unicode-emoji.gemspec
CHANGED
@@ -5,8 +5,8 @@ require File.dirname(__FILE__) + "/lib/unicode/emoji/constants"
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "unicode-emoji"
|
7
7
|
gem.version = Unicode::Emoji::VERSION
|
8
|
-
gem.summary = "
|
9
|
-
gem.description = "[Emoji #{Unicode::Emoji::EMOJI_VERSION}]
|
8
|
+
gem.summary = "Emoji data and regex"
|
9
|
+
gem.description = "[Emoji #{Unicode::Emoji::EMOJI_VERSION}] Provides Unicode Emoji data and regexes, incorporating the latest Unicode and Emoji standards. Includes a categorized list of recommended Emoji."
|
10
10
|
gem.authors = ["Jan Lelis"]
|
11
11
|
gem.email = ["hi@ruby.consulting"]
|
12
12
|
gem.homepage = "https://github.com/janlelis/unicode-emoji"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
gem.metadata = { "rubygems_mfa_required" => "true" }
|
20
20
|
|
21
|
-
gem.required_ruby_version = ">= 2.
|
21
|
+
gem.required_ruby_version = ">= 2.5", "< 4.0"
|
22
22
|
|
23
23
|
gem.add_dependency "unicode-version", "~> 1.0"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode-version
|
@@ -24,9 +24,9 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
description: "[Emoji 16.0]
|
28
|
-
|
29
|
-
|
27
|
+
description: "[Emoji 16.0] Provides Unicode Emoji data and regexes, incorporating
|
28
|
+
the latest Unicode and Emoji standards. Includes a categorized list of recommended
|
29
|
+
Emoji."
|
30
30
|
email:
|
31
31
|
- hi@ruby.consulting
|
32
32
|
executables: []
|
@@ -49,9 +49,12 @@ files:
|
|
49
49
|
- lib/unicode/emoji/generated/regex.rb
|
50
50
|
- lib/unicode/emoji/generated/regex_any.rb
|
51
51
|
- lib/unicode/emoji/generated/regex_basic.rb
|
52
|
+
- lib/unicode/emoji/generated/regex_include_mqe.rb
|
53
|
+
- lib/unicode/emoji/generated/regex_include_mqe_uqe.rb
|
52
54
|
- lib/unicode/emoji/generated/regex_include_text.rb
|
53
55
|
- lib/unicode/emoji/generated/regex_picto.rb
|
54
56
|
- lib/unicode/emoji/generated/regex_picto_no_emoji.rb
|
57
|
+
- lib/unicode/emoji/generated/regex_possible.rb
|
55
58
|
- lib/unicode/emoji/generated/regex_text.rb
|
56
59
|
- lib/unicode/emoji/generated/regex_valid.rb
|
57
60
|
- lib/unicode/emoji/generated/regex_valid_include_text.rb
|
@@ -60,9 +63,12 @@ files:
|
|
60
63
|
- lib/unicode/emoji/generated_native/regex.rb
|
61
64
|
- lib/unicode/emoji/generated_native/regex_any.rb
|
62
65
|
- lib/unicode/emoji/generated_native/regex_basic.rb
|
66
|
+
- lib/unicode/emoji/generated_native/regex_include_mqe.rb
|
67
|
+
- lib/unicode/emoji/generated_native/regex_include_mqe_uqe.rb
|
63
68
|
- lib/unicode/emoji/generated_native/regex_include_text.rb
|
64
69
|
- lib/unicode/emoji/generated_native/regex_picto.rb
|
65
70
|
- lib/unicode/emoji/generated_native/regex_picto_no_emoji.rb
|
71
|
+
- lib/unicode/emoji/generated_native/regex_possible.rb
|
66
72
|
- lib/unicode/emoji/generated_native/regex_text.rb
|
67
73
|
- lib/unicode/emoji/generated_native/regex_valid.rb
|
68
74
|
- lib/unicode/emoji/generated_native/regex_valid_include_text.rb
|
@@ -70,6 +76,10 @@ files:
|
|
70
76
|
- lib/unicode/emoji/generated_native/regex_well_formed_include_text.rb
|
71
77
|
- lib/unicode/emoji/index.rb
|
72
78
|
- lib/unicode/emoji/lazy_constants.rb
|
79
|
+
- lib/unicode/emoji/list.rb
|
80
|
+
- spec/data/.keep
|
81
|
+
- spec/data/emoji-test.txt
|
82
|
+
- spec/emoji_test_txt_spec.rb
|
73
83
|
- spec/unicode_emoji_spec.rb
|
74
84
|
- unicode-emoji.gemspec
|
75
85
|
homepage: https://github.com/janlelis/unicode-emoji
|
@@ -85,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
95
|
requirements:
|
86
96
|
- - ">="
|
87
97
|
- !ruby/object:Gem::Version
|
88
|
-
version: '2.
|
98
|
+
version: '2.5'
|
89
99
|
- - "<"
|
90
100
|
- !ruby/object:Gem::Version
|
91
101
|
version: '4.0'
|
@@ -98,6 +108,9 @@ requirements: []
|
|
98
108
|
rubygems_version: 3.5.21
|
99
109
|
signing_key:
|
100
110
|
specification_version: 4
|
101
|
-
summary:
|
111
|
+
summary: Emoji data and regex
|
102
112
|
test_files:
|
113
|
+
- spec/data/.keep
|
114
|
+
- spec/data/emoji-test.txt
|
115
|
+
- spec/emoji_test_txt_spec.rb
|
103
116
|
- spec/unicode_emoji_spec.rb
|