oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1package emoji
2
3import "testing"
4
5// LOOK3's list half: RGI sequences are icons, in their fully-qualified
6// form; anything else is not.
7func TestCanonical(t *testing.T) {
8 cases := map[string]string{
9 "๐Ÿš€": "๐Ÿš€",
10 "โ˜บ": "โ˜บ๏ธ",
11 "โ˜บ๏ธ": "โ˜บ๏ธ",
12 "๐Ÿ‘๐Ÿฝ": "๐Ÿ‘๐Ÿฝ",
13 "๐Ÿ‡ฎ๐Ÿ‡ช": "๐Ÿ‡ฎ๐Ÿ‡ช",
14 "#๏ธโƒฃ": "#๏ธโƒฃ",
15 "๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ": "๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ",
16 "โค๏ธโ€๐Ÿ”ฅ": "โค๏ธโ€๐Ÿ”ฅ",
17 }
18 for in, want := range cases {
19 got, ok := Canonical(in)
20 if !ok || got != want {
21 t.Errorf("Canonical(%q) = %q, %v; want %q", in, got, ok, want)
22 }
23 }
24 for _, in := range []string{"", "a", "๐Ÿš€๐Ÿš€", "๐Ÿฝ", "๎€€", "๐Ÿš€ ",
25 "rocket", "\U0001FAE9x"} {
26 if got, ok := Canonical(in); ok {
27 t.Errorf("Canonical(%q) = %q, accepted", in, got)
28 }
29 }
30}
31
32func TestTheListIsVersion16(t *testing.T) {
33 if Count() != 3781-9 && Count() < 3700 {
34 t.Fatalf("Count() = %d", Count())
35 }
36 if len(Groups) != 9 {
37 t.Fatalf("groups %v", Groups)
38 }
39 if _, ok := Canonical("๐Ÿซฉ"); !ok { // face with bags under eyes, 16.0
40 t.Fatal("a 16.0 emoji is missing")
41 }
42}
43