diff --git a/common/buf/buffered_reader_test.go b/common/buf/buffered_reader_test.go index 7d23e4076..d646ee034 100644 --- a/common/buf/buffered_reader_test.go +++ b/common/buf/buffered_reader_test.go @@ -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) diff --git a/common/buf/buffered_writer_test.go b/common/buf/buffered_writer_test.go index 12154ee6c..9368633e4 100644 --- a/common/buf/buffered_writer_test.go +++ b/common/buf/buffered_writer_test.go @@ -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) } diff --git a/common/buf/writer_test.go b/common/buf/writer_test.go index b91006904..69198f310 100644 --- a/common/buf/writer_test.go +++ b/common/buf/writer_test.go @@ -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) { diff --git a/common/protocol/time_test.go b/common/protocol/time_test.go index 8ed761e53..42b1c99dd 100644 --- a/common/protocol/time_test.go +++ b/common/protocol/time_test.go @@ -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)) } } diff --git a/testing/scenarios/dns_test.go b/testing/scenarios/dns_test.go index 0360d1578..665270776 100644 --- a/testing/scenarios/dns_test.go +++ b/testing/scenarios/dns_test.go @@ -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) { diff --git a/testing/scenarios/dokodemo_test.go b/testing/scenarios/dokodemo_test.go index 9deee05bc..b7e2d7389 100644 --- a/testing/scenarios/dokodemo_test.go +++ b/testing/scenarios/dokodemo_test.go @@ -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) { diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index 903fd943e..7d1b84c07 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -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) { diff --git a/testing/scenarios/shadowsocks_test.go b/testing/scenarios/shadowsocks_test.go index 94d8a0e96..fb444c5c2 100644 --- a/testing/scenarios/shadowsocks_test.go +++ b/testing/scenarios/shadowsocks_test.go @@ -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) { diff --git a/testing/scenarios/socks_test.go b/testing/scenarios/socks_test.go index 264ab2cdd..5351ad1c6 100644 --- a/testing/scenarios/socks_test.go +++ b/testing/scenarios/socks_test.go @@ -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) { diff --git a/testing/scenarios/tls_test.go b/testing/scenarios/tls_test.go index f60ba490a..9186cfd5d 100644 --- a/testing/scenarios/tls_test.go +++ b/testing/scenarios/tls_test.go @@ -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) { diff --git a/testing/scenarios/transport_test.go b/testing/scenarios/transport_test.go index e5ae32699..a657366e8 100644 --- a/testing/scenarios/transport_test.go +++ b/testing/scenarios/transport_test.go @@ -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) { diff --git a/testing/scenarios/vmess_test.go b/testing/scenarios/vmess_test.go index d8c5edcfe..0a10669ec 100644 --- a/testing/scenarios/vmess_test.go +++ b/testing/scenarios/vmess_test.go @@ -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) { diff --git a/transport/internet/dialer_test.go b/transport/internet/dialer_test.go index 07ce06096..dbc9e587c 100644 --- a/transport/internet/dialer_test.go +++ b/transport/internet/dialer_test.go @@ -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() } diff --git a/transport/internet/header_test.go b/transport/internet/header_test.go index 4cfc72ee2..65a7afa19 100644 --- a/transport/internet/header_test.go +++ b/transport/internet/header_test.go @@ -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) { diff --git a/transport/internet/headers/http/http_test.go b/transport/internet/headers/http/http_test.go index 37a990d28..26ff5fb0f 100644 --- a/transport/internet/headers/http/http_test.go +++ b/transport/internet/headers/http/http_test.go @@ -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) { diff --git a/transport/internet/headers/srtp/srtp_test.go b/transport/internet/headers/srtp/srtp_test.go index 4417e1c7e..db138fa52 100644 --- a/transport/internet/headers/srtp/srtp_test.go +++ b/transport/internet/headers/srtp/srtp_test.go @@ -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()) } diff --git a/transport/internet/headers/utp/utp_test.go b/transport/internet/headers/utp/utp_test.go index 06760db3d..eaffb70c6 100644 --- a/transport/internet/headers/utp/utp_test.go +++ b/transport/internet/headers/utp/utp_test.go @@ -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()) } diff --git a/transport/internet/headers/wechat/wechat_test.go b/transport/internet/headers/wechat/wechat_test.go index e3e840eaf..9a26ffa49 100644 --- a/transport/internet/headers/wechat/wechat_test.go +++ b/transport/internet/headers/wechat/wechat_test.go @@ -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) { diff --git a/transport/internet/kcp/connection_test.go b/transport/internet/kcp/connection_test.go index 786c320c2..f397a34f9 100644 --- a/transport/internet/kcp/connection_test.go +++ b/transport/internet/kcp/connection_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - . "v2ray.com/ext/assert" . "v2ray.com/core/transport/internet/kcp" + . "v2ray.com/ext/assert" ) type NoOpConn struct{} diff --git a/transport/internet/kcp/crypt_test.go b/transport/internet/kcp/crypt_test.go index 524170766..b3db18b8a 100644 --- a/transport/internet/kcp/crypt_test.go +++ b/transport/internet/kcp/crypt_test.go @@ -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) { diff --git a/transport/internet/kcp/kcp_test.go b/transport/internet/kcp/kcp_test.go index 1d6dadd78..d7625b3b4 100644 --- a/transport/internet/kcp/kcp_test.go +++ b/transport/internet/kcp/kcp_test.go @@ -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) { diff --git a/transport/internet/kcp/segment_test.go b/transport/internet/kcp/segment_test.go index 13247692b..e13f89fcc 100644 --- a/transport/internet/kcp/segment_test.go +++ b/transport/internet/kcp/segment_test.go @@ -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) { diff --git a/transport/ray/direct_test.go b/transport/ray/direct_test.go index 6a16296c1..4350d7ca1 100644 --- a/transport/ray/direct_test.go +++ b/transport/ray/direct_test.go @@ -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) {