mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
format code
This commit is contained in:
parent
1d3c8098e9
commit
6c9a60100d
@ -26,7 +26,7 @@ func TestBufferedReader(t *testing.T) {
|
||||
assert(err, IsNil)
|
||||
|
||||
len2 := content.Len()
|
||||
assert(len - len2, GreaterThan, 16)
|
||||
assert(len-len2, GreaterThan, 16)
|
||||
|
||||
nBytes, err = reader.Read(payload)
|
||||
assert(nBytes, Equals, 16)
|
||||
|
@ -49,6 +49,6 @@ func TestBufferedWriterLargePayload(t *testing.T) {
|
||||
nBytes, err = writer.Write(payload[512:])
|
||||
assert(err, IsNil)
|
||||
assert(writer.Flush(), IsNil)
|
||||
assert(nBytes, Equals, 64*1024 - 512)
|
||||
assert(nBytes, Equals, 64*1024-512)
|
||||
assert(content.Bytes(), Equals, payload)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"io"
|
||||
|
||||
. "v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/transport/ray"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestWriter(t *testing.T) {
|
||||
|
@ -17,7 +17,7 @@ func TestGenerateRandomInt64InRange(t *testing.T) {
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
val := int64(generator())
|
||||
assert(val, AtMost, base + int64(delta))
|
||||
assert(val, AtLeast, base - int64(delta))
|
||||
assert(val, AtMost, base+int64(delta))
|
||||
assert(val, AtLeast, base-int64(delta))
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
"v2ray.com/core/proxy/blackhole"
|
||||
"v2ray.com/core/proxy/freedom"
|
||||
"v2ray.com/core/proxy/socks"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestResolveIP(t *testing.T) {
|
||||
|
@ -15,9 +15,9 @@ import (
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/inbound"
|
||||
"v2ray.com/core/proxy/vmess/outbound"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/testing/servers/udp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestDokodemoTCP(t *testing.T) {
|
||||
|
@ -24,10 +24,10 @@ import (
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/inbound"
|
||||
"v2ray.com/core/proxy/vmess/outbound"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/testing/servers/udp"
|
||||
"v2ray.com/core/transport/internet"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestPassiveConnection(t *testing.T) {
|
||||
|
@ -15,9 +15,9 @@ import (
|
||||
"v2ray.com/core/proxy/dokodemo"
|
||||
"v2ray.com/core/proxy/freedom"
|
||||
"v2ray.com/core/proxy/shadowsocks"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/testing/servers/udp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestShadowsocksAES256TCP(t *testing.T) {
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
"v2ray.com/core/proxy/dokodemo"
|
||||
"v2ray.com/core/proxy/freedom"
|
||||
"v2ray.com/core/proxy/socks"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/testing/servers/udp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestSocksBridgeTCP(t *testing.T) {
|
||||
|
@ -16,12 +16,12 @@ import (
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/inbound"
|
||||
"v2ray.com/core/proxy/vmess/outbound"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
tlsgen "v2ray.com/core/testing/tls"
|
||||
"v2ray.com/core/transport/internet"
|
||||
"v2ray.com/core/transport/internet/tls"
|
||||
"v2ray.com/core/transport/internet/websocket"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestSimpleTLSConnection(t *testing.T) {
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/inbound"
|
||||
"v2ray.com/core/proxy/vmess/outbound"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/transport/internet"
|
||||
"v2ray.com/core/transport/internet/headers/http"
|
||||
tcptransport "v2ray.com/core/transport/internet/tcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestHttpConnectionHeader(t *testing.T) {
|
||||
|
@ -18,10 +18,10 @@ import (
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/inbound"
|
||||
"v2ray.com/core/proxy/vmess/outbound"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
"v2ray.com/core/testing/servers/udp"
|
||||
"v2ray.com/core/transport/internet"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestVMessDynamicPort(t *testing.T) {
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/net"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/testing/servers/tcp"
|
||||
. "v2ray.com/core/transport/internet"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestDialWithLocalAddr(t *testing.T) {
|
||||
@ -20,6 +20,6 @@ func TestDialWithLocalAddr(t *testing.T) {
|
||||
|
||||
conn, err := DialSystem(context.Background(), net.LocalHostIP, net.TCPDestination(net.LocalHostIP, dest.Port))
|
||||
assert(err, IsNil)
|
||||
assert(conn.RemoteAddr().String(), Equals, "127.0.0.1:" + dest.Port.String())
|
||||
assert(conn.RemoteAddr().String(), Equals, "127.0.0.1:"+dest.Port.String())
|
||||
conn.Close()
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package internet_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet"
|
||||
"v2ray.com/core/transport/internet/headers/noop"
|
||||
"v2ray.com/core/transport/internet/headers/srtp"
|
||||
"v2ray.com/core/transport/internet/headers/utp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestAllHeadersLoadable(t *testing.T) {
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/headers/http"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestReaderWriter(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/headers/srtp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestSRTPWrite(t *testing.T) {
|
||||
@ -18,5 +18,5 @@ func TestSRTPWrite(t *testing.T) {
|
||||
payload.AppendSupplier(srtp.Write)
|
||||
payload.Append(content)
|
||||
|
||||
assert(payload.Len(), Equals, len(content) + srtp.Size())
|
||||
assert(payload.Len(), Equals, len(content)+srtp.Size())
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/headers/utp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestUTPWrite(t *testing.T) {
|
||||
@ -18,5 +18,5 @@ func TestUTPWrite(t *testing.T) {
|
||||
payload.AppendSupplier(utp.Write)
|
||||
payload.Append(content)
|
||||
|
||||
assert(payload.Len(), Equals, len(content) + utp.Size())
|
||||
assert(payload.Len(), Equals, len(content)+utp.Size())
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/headers/wechat"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestUTPWrite(t *testing.T) {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/kcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
type NoOpConn struct{}
|
||||
|
@ -3,8 +3,8 @@ package kcp_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/kcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestSimpleAuthenticator(t *testing.T) {
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/net"
|
||||
. "v2ray.com/ext/assert"
|
||||
"v2ray.com/core/transport/internet"
|
||||
. "v2ray.com/core/transport/internet/kcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestDialAndListen(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/internet/kcp"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestBadSegment(t *testing.T) {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/ext/assert"
|
||||
. "v2ray.com/core/transport/ray"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestStreamIO(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user