From bfa8a3f1147e5de18030d9d81c6ac3f292193fb1 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Tue, 5 Mar 2019 11:38:46 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Update=20specs=20to=20check=20Un?= =?UTF-8?q?icode=2012.0=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/emoji_regex/emoji_regex_spec.rb | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/spec/emoji_regex/emoji_regex_spec.rb b/spec/emoji_regex/emoji_regex_spec.rb index 7167178..fe85df3 100644 --- a/spec/emoji_regex/emoji_regex_spec.rb +++ b/spec/emoji_regex/emoji_regex_spec.rb @@ -2,48 +2,64 @@ RSpec.describe EmojiRegex do describe "::Regex" do - it "matches ⌚️ default emoji presentation character (Emoji_Presentation)" do + it "matches ⌚️ watch (default emoji presentation character (Emoji_Presentation))" do expect("\u{231A}".scan(EmojiRegex::Regex)).to eql(["\u{231A}"]) end - it "matches ↔️ default text presentation character rendered as emoji" do + it "matches ↔️ left-right arrow (default text presentation character rendered as emoji)" do expect("\u{2194}\u{FE0F}".scan(EmojiRegex::Regex)).to eql(["\u{2194}\u{FE0F}"]) end - it "matches 👩 emoji modifier base (Emoji_Modifier_Base)" do + it "matches 👩 woman (emoji modifier base (Emoji_Modifier_Base))" do expect("\u{1F469}".scan(EmojiRegex::Regex)).to eql(["\u{1F469}"]) end - it "matches 👩🏿 emoji modifier base followed by a modifier" do + it "matches 👩🏿 woman: dark skin tone (emoji modifier base followed by a modifier)" do expect("\u{1F469}\u{1F3FF}".scan(EmojiRegex::Regex)).to eql(["\u{1F469}\u{1F3FF}"]) end + it "matches 👩🏾‍✈️🏿 woman pilot: medium-dark skin tone (emoji modifier base followed by a modifier, with ZWJ sequence and default text representation character)" do + expect("\u{1F469}\u{1F3FE}\u{200D}\u{2708}\u{FE0F}".scan(EmojiRegex::Regex)).to eql(["\u{1F469}\u{1F3FE}\u{200D}\u{2708}\u{FE0F}"]) + end + + it "matches 🧏🏻‍♀️ deaf woman: light skin tone (emoji modifier bae followed by a modifier and gender ZWJ sequence)" do + expect("\u{1F9CF}\u{1F3FB}\u{200D}\u{2640}\u{FE0F}".scan(EmojiRegex::Regex)).to eql(["\u{1F9CF}\u{1F3FB}\u{200D}\u{2640}\u{FE0F}"]) + end + it "doesn't match non-emojis" do expect("abc".scan(EmojiRegex::Regex)).to eql([]) end end describe '::Text' do - it "matches ⌚️ default emoji presentation character (Emoji_Presentation)" do + it "matches ⌚️ watch (default emoji presentation character (Emoji_Presentation))" do expect("\u{231A}".scan(EmojiRegex::Text)).to eql(["\u{231A}"]) end - it "matches ↔ default text representation character" do + it "matches ↔ left-right arrow (default text representation character)" do expect("\u{2194}".scan(EmojiRegex::Text)).to eql(["\u{2194}"]) end - it "matches ↔️ default text presentation character rendered as emoji" do + it "matches ↔️ left-right arrow (default text presentation character rendered as emoji)" do expect("\u{2194}\u{FE0F}".scan(EmojiRegex::Text)).to eql(["\u{2194}\u{FE0F}"]) end - it "matches 👩 emoji modifier base (Emoji_Modifier_Base)" do + it "matches 👩 woman (emoji modifier base (Emoji_Modifier_Base))" do expect("\u{1F469}".scan(EmojiRegex::Text)).to eql(["\u{1F469}"]) end - it "matches 👩🏿 emoji modifier base followed by a modifier" do + it "matches 👩🏿 woman: dark skin tone (emoji modifier base followed by a modifier)" do expect("\u{1F469}\u{1F3FF}".scan(EmojiRegex::Text)).to eql(["\u{1F469}\u{1F3FF}"]) end + it "matches 👩🏾‍✈️🏿 woman pilot: medium-dark skin tone (emoji modifier base followed by a modifier, with ZWJ sequence and default text representation character)" do + expect("\u{1F469}\u{1F3FE}\u{200D}\u{2708}\u{FE0F}".scan(EmojiRegex::Text)).to eql(["\u{1F469}\u{1F3FE}\u{200D}\u{2708}\u{FE0F}"]) + end + + it "matches 🧏🏻‍♀️ deaf woman: light skin tone (emoji modifier bae followed by a modifier and gender ZWJ sequence)" do + expect("\u{1F9CF}\u{1F3FB}\u{200D}\u{2640}\u{FE0F}".scan(EmojiRegex::Text)).to eql(["\u{1F9CF}\u{1F3FB}\u{200D}\u{2640}\u{FE0F}"]) + end + it "doesn't match non-emojis" do expect("abc".scan(EmojiRegex::Text)).to eql([]) end