Browse Source

format code

Darien Raymond 8 years ago
parent
commit
6c9a60100d

+ 1 - 1
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)

+ 1 - 1
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)
 }

+ 1 - 1
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) {

+ 2 - 2
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))
 	}
 }

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 2 - 2
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()
 }

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 2 - 2
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())
 }

+ 2 - 2
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())
 }

+ 1 - 1
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) {

+ 1 - 1
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{}

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {