Chat Message support Encode now

This commit is contained in:
Tnze
2019-07-24 02:54:36 +08:00
parent 6c4924af96
commit a91caff32f
2 changed files with 27 additions and 9 deletions

View File

@ -3,6 +3,7 @@ package chat
import (
// "fmt"
//"github.com/mattn/go-colorable"//On Windows need
"bytes"
"testing"
)
@ -87,3 +88,11 @@ func TestChatMsgClearString(t *testing.T) {
}
}
}
func TestMessage_Encode(t *testing.T) {
codeMsg := Message{Translate: "multiplayer.disconnect.server_full"}.Encode()
wantMsg := []byte(`{"translate":"multiplayer.disconnect.server_full"}`)
if !bytes.Equal(codeMsg, wantMsg) {
t.Error("encode Message error: get", string(codeMsg), ", want", string(wantMsg))
}
}