-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgoemojipic_test.go
43 lines (36 loc) · 1.12 KB
/
goemojipic_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package goemojipic
import (
"fmt"
"testing"
)
func TestSplit(t *testing.T) {
data := SplitEmojiString("a 🥰 b🌈😃🥰🌍🍞🚗📞🇨🇮🏴3️⃣🎉🐎🍆🏁🐘🐧🐼")
for _, str := range data {
if str.IsEmoji {
img, err := GetApplePic(str.Text)
if err != nil {
t.Error(err)
}
fmt.Printf("img loaded %d\n", len(img))
}
}
data = SplitEmojiString("")
if len(data) != 0 {
t.Error("Failed to handle empty string")
}
data = SplitEmojiString("a")
if len(data) != 1 && data[0].Text != "a" && data[0].IsEmoji != false {
t.Error("Failed to handle: a")
}
data = SplitEmojiString("👨👩👧👦")
if len(data) != 1 && data[0].Text != "👨👩👧👦" && data[0].IsEmoji != true {
t.Error("Failed to handle: a")
}
data = SplitEmojiString("👨👩👧👦1")
if len(data) != 2 && data[0].Text != "👨👩👧👦" && data[0].IsEmoji != true {
t.Error("Failed to handle: 👨👩👧👦1")
}
if data[1].Text != "1" && data[0].IsEmoji != false {
t.Error("Failed to handle: 👨👩👧👦1")
}
}