spec/unicode_emoji_spec.rb in unicode-emoji-3.5.0 vs spec/unicode_emoji_spec.rb in unicode-emoji-3.6.0

- old
+ new

@@ -67,10 +67,18 @@ it "matches emoji keycap sequences" do "2️⃣ keycap: 2" =~ Unicode::Emoji::REGEX assert_equal "2️⃣", $& end + it "does not match non-emoji keycap sequences" do + "8⃣ text keycap: 8" =~ Unicode::Emoji::REGEX + assert_nil $& + + "#⃣ text keycap: #" =~ Unicode::Emoji::REGEX + assert_nil $& + end + it "matches recommended tag sequences" do "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland" =~ Unicode::Emoji::REGEX assert_equal "🏴󠁧󠁢󠁳󠁣󠁴󠁿", $& end @@ -188,10 +196,18 @@ it "matches emoji keycap sequences" do "2️⃣ keycap: 2" =~ Unicode::Emoji::REGEX_VALID assert_equal "2️⃣", $& end + it "does not match non-emoji keycap sequences" do + "8⃣ text keycap: 8" =~ Unicode::Emoji::REGEX_VALID + assert_nil $& + + "#⃣ text keycap: #" =~ Unicode::Emoji::REGEX_VALID + assert_nil $& + end + it "matches recommended tag sequences" do "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland" =~ Unicode::Emoji::REGEX_VALID assert_equal "🏴󠁧󠁢󠁳󠁣󠁴󠁿", $& end @@ -270,10 +286,18 @@ it "matches emoji keycap sequences" do "2️⃣ keycap: 2" =~ Unicode::Emoji::REGEX_WELL_FORMED assert_equal "2️⃣", $& end + it "does not match non-emoji keycap sequences" do + "8⃣ text keycap: 8" =~ Unicode::Emoji::REGEX_WELL_FORMED + assert_nil $& + + "#⃣ text keycap: #" =~ Unicode::Emoji::REGEX_WELL_FORMED + assert_nil $& + end + it "matches recommended tag sequences" do "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland" =~ Unicode::Emoji::REGEX_WELL_FORMED assert_equal "🏴󠁧󠁢󠁳󠁣󠁴󠁿", $& end @@ -402,9 +426,17 @@ end it "does not match emoji keycap sequences" do "2️⃣ keycap: 2" =~ Unicode::Emoji::REGEX_TEXT assert_nil $& + end + + it "matches non-emoji keycap sequences" do + "8⃣ text keycap: 8" =~ Unicode::Emoji::REGEX_TEXT + assert_equal "8⃣", $& + + "#⃣ text keycap: #" =~ Unicode::Emoji::REGEX_TEXT + assert_equal "#⃣", $& end it "does not match tag sequences" do "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland" =~ Unicode::Emoji::REGEX_TEXT assert_nil $&