From ac4872bcb503723aab08861186c071617b64e054 Mon Sep 17 00:00:00 2001 From: YamiOdymel Date: Thu, 22 Dec 2022 19:54:04 +0800 Subject: [PATCH] Fixed Keycap --- search.go | 6 ++++-- tests/search_test.go | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/search.go b/search.go index a846c87..df5a851 100644 --- a/search.go +++ b/search.go @@ -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 } @@ -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 } diff --git a/tests/search_test.go b/tests/search_test.go index c34a6b3..f1a3934 100644 --- a/tests/search_test.go +++ b/tests/search_test.go @@ -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")