1
0
mirror of https://github.com/fumiama/emozi.git synced 2026-06-10 21:24:20 +08:00
This commit is contained in:
源文雨
2024-02-14 18:39:07 +09:00
parent 9463d5e7b6
commit ceb7686da6
18 changed files with 1776 additions and 0 deletions

29
coder_test.go Normal file
View File

@@ -0,0 +1,29 @@
package emozi
import (
"testing"
"time"
)
func TestEncode(t *testing.T) {
c, err := NewCoder(false, time.Minute)
if err != nil {
t.Fatal(err)
}
es, err := c.Encode("你好,世界!看看多音字:行。")
if err != nil {
t.Fatal(err)
}
t.Log(es.String())
if es.String() != "🥛👔🐴👤🌹🐱🐴👩,💦🌞😨🌍➕✌😨👨‍🌾!😭🔐🍉👁️😭🔐🍉👁️🔪🌀🍉🪩🐑🎵🍉🎵👈🌞😨🚼:[👇🦅🧗⛕|🌹👍🧗⛕]。" {
t.Fatal("got", es.String())
}
es, err = c.Encode("你好,世界!指定多音字:银行行。", 1, 0)
if err != nil {
t.Fatal(err)
}
t.Log(es.String())
if es.String() != "🥛👔🐴👤🌹🐱🐴👩,💦🌞😨🌍➕✌😨👨‍🌾!🐽🌞🐴✋🔪🦅😨🏠🔪🌀🍉🪩🐑🎵🍉🎵👈🌞😨🚼:🐑🎵🧗💰🌹👍🧗⛕👇🦅🧗⛕。" {
t.Fatal("got", es.String())
}
}