mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-24 06:29:10 -04:00
remove dependency on assert lib
This commit is contained in:
@@ -3,16 +3,16 @@ package encoding_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/uuid"
|
||||
. "v2ray.com/core/proxy/vmess/encoding"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestSwitchAccount(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
sa := &protocol.CommandSwitchAccount{
|
||||
Port: 1234,
|
||||
ID: uuid.New(),
|
||||
@@ -22,19 +22,16 @@ func TestSwitchAccount(t *testing.T) {
|
||||
}
|
||||
|
||||
buffer := buf.New()
|
||||
err := MarshalCommand(sa, buffer)
|
||||
assert(err, IsNil)
|
||||
common.Must(MarshalCommand(sa, buffer))
|
||||
|
||||
cmd, err := UnmarshalCommand(1, buffer.BytesFrom(2))
|
||||
assert(err, IsNil)
|
||||
common.Must(err)
|
||||
|
||||
sa2, ok := cmd.(*protocol.CommandSwitchAccount)
|
||||
assert(ok, IsTrue)
|
||||
assert(sa.Host, IsNil)
|
||||
assert(sa2.Host, IsNil)
|
||||
assert(sa.Port, Equals, sa2.Port)
|
||||
assert(sa.ID.String(), Equals, sa2.ID.String())
|
||||
assert(sa.AlterIds, Equals, sa2.AlterIds)
|
||||
assert(byte(sa.Level), Equals, byte(sa2.Level))
|
||||
assert(sa.ValidMin, Equals, sa2.ValidMin)
|
||||
if !ok {
|
||||
t.Fatal("failed to convert command to CommandSwitchAccount")
|
||||
}
|
||||
if r := cmp.Diff(sa2, sa); r != "" {
|
||||
t.Error(r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user