Переглянути джерело

leveral serial.String in code

Darien Raymond 10 роки тому
батько
коміт
36848af749

+ 2 - 2
common/net/testing/unit/destination_test.go

@@ -14,7 +14,7 @@ func TestTCPDestination(t *testing.T) {
 	dest := v2net.NewTCPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}, 80))
 	assert.Bool(dest.IsTCP()).IsTrue()
 	assert.Bool(dest.IsUDP()).IsFalse()
-	assert.StringLiteral(dest.String()).Equals("tcp:1.2.3.4:80")
+	assert.String(dest).Equals("tcp:1.2.3.4:80")
 }
 
 func TestUDPDestination(t *testing.T) {
@@ -23,5 +23,5 @@ func TestUDPDestination(t *testing.T) {
 	dest := v2net.NewUDPDestination(v2net.IPAddress([]byte{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88}, 53))
 	assert.Bool(dest.IsTCP()).IsFalse()
 	assert.Bool(dest.IsUDP()).IsTrue()
-	assert.StringLiteral(dest.String()).Equals("udp:[2001:4860:4860::8888]:53")
+	assert.String(dest).Equals("udp:[2001:4860:4860::8888]:53")
 }

+ 3 - 3
proxy/socks/config/json/config_test.go

@@ -28,7 +28,7 @@ func TestDefaultIPAddress(t *testing.T) {
 	v2testing.Current(t)
 
 	socksConfig := jsonconfig.CreateConfig("socks", config.TypeInbound).(*SocksConfig)
-	assert.StringLiteral(socksConfig.IP().String()).Equals("127.0.0.1")
+	assert.String(socksConfig.IP()).Equals("127.0.0.1")
 }
 
 func TestIPAddressParsing(t *testing.T) {
@@ -37,7 +37,7 @@ func TestIPAddressParsing(t *testing.T) {
 	var ipAddress IPAddress
 	err := json.Unmarshal([]byte("\"1.2.3.4\""), &ipAddress)
 	assert.Error(err).IsNil()
-	assert.StringLiteral(net.IP(ipAddress).String()).Equals("1.2.3.4")
+	assert.String(net.IP(ipAddress)).Equals("1.2.3.4")
 }
 
 func TestNoAuthConfig(t *testing.T) {
@@ -48,7 +48,7 @@ func TestNoAuthConfig(t *testing.T) {
 	assert.Error(err).IsNil()
 	assert.Bool(config.IsNoAuth()).IsTrue()
 	assert.Bool(config.IsPassword()).IsFalse()
-	assert.StringLiteral(config.IP().String()).Equals("8.8.8.8")
+	assert.String(config.IP()).Equals("8.8.8.8")
 	assert.Bool(config.UDPEnabled).IsFalse()
 }
 

+ 1 - 1
proxy/socks/protocol/udp_test.go

@@ -31,6 +31,6 @@ func TestDomainAddressRequest(t *testing.T) {
 	assert.Error(err).IsNil()
 
 	assert.Byte(request.Fragment).Equals(1)
-	assert.StringLiteral(request.Address.String()).Equals("v2ray.com:80")
+	assert.String(request.Address).Equals("v2ray.com:80")
 	assert.Bytes(request.Data.Value).Equals([]byte("Actual payload"))
 }

+ 1 - 1
proxy/vmess/protocol/vmess_test.go

@@ -78,7 +78,7 @@ func TestVMessSerialization(t *testing.T) {
 	assert.Bytes(actualRequest.RequestKey).Named("RequestKey").Equals(request.RequestKey[:])
 	assert.Bytes(actualRequest.ResponseHeader).Named("ResponseHeader").Equals(request.ResponseHeader[:])
 	assert.Byte(actualRequest.Command).Named("Command").Equals(request.Command)
-	assert.StringLiteral(actualRequest.Address.String()).Named("Address").Equals(request.Address.String())
+	assert.String(actualRequest.Address).Named("Address").Equals(request.Address.String())
 }
 
 func TestReadSingleByte(t *testing.T) {