mirror of
https://github.com/fumiama/emozi.git
synced 2026-06-10 21:24:20 +08:00
init
This commit is contained in:
29
coder_test.go
Normal file
29
coder_test.go
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user