Skip to content

Commit

Permalink
Fixed Keycap
Browse files Browse the repository at this point in the history
  • Loading branch information
YamiOdymel committed Dec 22, 2022
1 parent 3e6703b commit ac4872b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func FindAll(input string) (detectedEmojis SearchResults) {
continue
}

//
// NOTE:https://github.com/tmdvs/Go-Emoji-Utils/issues/12
if index-1 >= 0 && isDecoratorUnicode(runes[index-1]) {
continue
}
Expand All @@ -96,7 +96,9 @@ func FindAll(input string) (detectedEmojis SearchResults) {

// Ignore any basic runes, we'll get funny partials
// that we dont care about
if len(hexKey) < 4 {
//
// NOTE: 31-FE0F-20E3 1️⃣ Keycap Digit, https://github.com/tmdvs/Go-Emoji-Utils/issues/5
if len(hexKey) < 2 {
continue
}

Expand Down
5 changes: 3 additions & 2 deletions tests/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ func BenchmarkComplexSearch(b *testing.B) {

func TestRemoveAllEmoji(t *testing.T) {

str := "This is a string 😄 🐷 with some 👍🏻 🙈 emoji! 🐷 🏃🏿‍♂️ 🥰"
str := "This is a 1️⃣string 😄 🐷 with some 👍🏻 🙈 emoji! 🐷 🏃🏿‍♂️ 🥰"

matches := emojiutils.FindAll(str)
totalUniqueEmoji := len(matches)
log.Println(matches)

assert.Equal(t, 6, totalUniqueEmoji, "There should be six different emoji")
assert.Equal(t, 7, totalUniqueEmoji, "There should be six different emoji")

emojiRemoved := emojiutils.RemoveAll(str)
assert.Equal(t, "This is a string with some emoji!", emojiRemoved, "There should be no emoji")
Expand Down

0 comments on commit ac4872b

Please sign in to comment.