Chat Message support Encode now
This commit is contained in:
@ -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))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user