From 3582b9d869877b15a5a52f40541fb891658f247d Mon Sep 17 00:00:00 2001 From: v2ray Date: Tue, 24 May 2016 15:29:08 +0200 Subject: [PATCH] move net/testing/assert into assert --- app/dns/config_json_test.go | 7 +++---- app/dns/server_test.go | 3 +-- common/net/address_test.go | 21 +++++++++---------- common/net/destination_test.go | 9 ++++---- common/protocol/raw/commands_test.go | 3 +-- common/protocol/raw/encoding_test.go | 5 ++--- proxy/dokodemo/dokodemo_test.go | 7 +++---- proxy/freedom/freedom_test.go | 5 ++--- proxy/http/server_test.go | 3 +-- proxy/shadowsocks/protocol_test.go | 13 ++++++------ proxy/socks/protocol/socks4_test.go | 3 +-- proxy/socks/protocol/socks_test.go | 5 ++--- proxy/socks/protocol/udp_test.go | 3 +-- shell/point/config_json_test.go | 5 ++--- .../net/testing => testing}/assert/address.go | 3 +-- .../testing => testing}/assert/destination.go | 3 +-- {common/net/testing => testing}/assert/ip.go | 3 +-- .../net/testing => testing}/assert/port.go | 3 +-- 18 files changed, 43 insertions(+), 61 deletions(-) rename {common/net/testing => testing}/assert/address.go (96%) rename {common/net/testing => testing}/assert/destination.go (94%) rename {common/net/testing => testing}/assert/ip.go (92%) rename {common/net/testing => testing}/assert/port.go (95%) diff --git a/app/dns/config_json_test.go b/app/dns/config_json_test.go index eccaea82a..0689fbfeb 100644 --- a/app/dns/config_json_test.go +++ b/app/dns/config_json_test.go @@ -8,7 +8,6 @@ import ( . "github.com/v2ray/v2ray-core/app/dns" v2net "github.com/v2ray/v2ray-core/common/net" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" ) @@ -24,7 +23,7 @@ func TestConfigParsing(t *testing.T) { err := json.Unmarshal([]byte(rawJson), config) assert.Error(err).IsNil() assert.Int(len(config.NameServers)).Equals(1) - netassert.Destination(config.NameServers[0]).IsUDP() - netassert.Address(config.NameServers[0].Address()).Equals(v2net.IPAddress([]byte{8, 8, 8, 8})) - netassert.Port(config.NameServers[0].Port()).Equals(v2net.Port(53)) + assert.Destination(config.NameServers[0]).IsUDP() + assert.Address(config.NameServers[0].Address()).Equals(v2net.IPAddress([]byte{8, 8, 8, 8})) + assert.Port(config.NameServers[0].Port()).Equals(v2net.Port(53)) } diff --git a/app/dns/server_test.go b/app/dns/server_test.go index ac6cbb4c9..5ffd3176a 100644 --- a/app/dns/server_test.go +++ b/app/dns/server_test.go @@ -10,7 +10,6 @@ import ( . "github.com/v2ray/v2ray-core/app/dns" "github.com/v2ray/v2ray-core/app/proxyman" v2net "github.com/v2ray/v2ray-core/common/net" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" "github.com/v2ray/v2ray-core/proxy/freedom" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" @@ -37,5 +36,5 @@ func TestDnsAdd(t *testing.T) { ips := server.Get(domain) assert.Int(len(ips)).Equals(1) - netassert.IP(ips[0].To4()).Equals(net.IP([]byte{127, 0, 0, 1})) + assert.IP(ips[0].To4()).Equals(net.IP([]byte{127, 0, 0, 1})) } diff --git a/common/net/address_test.go b/common/net/address_test.go index e1acfafcc..962601d3e 100644 --- a/common/net/address_test.go +++ b/common/net/address_test.go @@ -5,7 +5,6 @@ import ( "testing" v2net "github.com/v2ray/v2ray-core/common/net" - v2netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" ) @@ -16,9 +15,9 @@ func TestIPv4Address(t *testing.T) { ip := []byte{byte(1), byte(2), byte(3), byte(4)} addr := v2net.IPAddress(ip) - v2netassert.Address(addr).IsIPv4() - v2netassert.Address(addr).IsNotIPv6() - v2netassert.Address(addr).IsNotDomain() + assert.Address(addr).IsIPv4() + assert.Address(addr).IsNotIPv6() + assert.Address(addr).IsNotDomain() assert.Bytes(addr.IP()).Equals(ip) assert.String(addr).Equals("1.2.3.4") } @@ -34,9 +33,9 @@ func TestIPv6Address(t *testing.T) { } addr := v2net.IPAddress(ip) - v2netassert.Address(addr).IsIPv6() - v2netassert.Address(addr).IsNotIPv4() - v2netassert.Address(addr).IsNotDomain() + assert.Address(addr).IsIPv6() + assert.Address(addr).IsNotIPv4() + assert.Address(addr).IsNotDomain() assert.Bytes(addr.IP()).Equals(ip) assert.String(addr).Equals("[102:304:102:304:102:304:102:304]") } @@ -59,9 +58,9 @@ func TestDomainAddress(t *testing.T) { domain := "v2ray.com" addr := v2net.DomainAddress(domain) - v2netassert.Address(addr).IsDomain() - v2netassert.Address(addr).IsNotIPv6() - v2netassert.Address(addr).IsNotIPv4() + assert.Address(addr).IsDomain() + assert.Address(addr).IsNotIPv6() + assert.Address(addr).IsNotIPv4() assert.StringLiteral(addr.Domain()).Equals(domain) assert.String(addr).Equals("v2ray.com") } @@ -71,7 +70,7 @@ func TestNetIPv4Address(t *testing.T) { ip := net.IPv4(1, 2, 3, 4) addr := v2net.IPAddress(ip) - v2netassert.Address(addr).IsIPv4() + assert.Address(addr).IsIPv4() assert.String(addr).Equals("1.2.3.4") } diff --git a/common/net/destination_test.go b/common/net/destination_test.go index a3e25f335..80166b681 100644 --- a/common/net/destination_test.go +++ b/common/net/destination_test.go @@ -4,7 +4,6 @@ import ( "testing" v2net "github.com/v2ray/v2ray-core/common/net" - v2netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" ) @@ -13,8 +12,8 @@ func TestTCPDestination(t *testing.T) { v2testing.Current(t) dest := v2net.TCPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80) - v2netassert.Destination(dest).IsTCP() - v2netassert.Destination(dest).IsNotUDP() + assert.Destination(dest).IsTCP() + assert.Destination(dest).IsNotUDP() assert.String(dest).Equals("tcp:1.2.3.4:80") } @@ -22,8 +21,8 @@ func TestUDPDestination(t *testing.T) { v2testing.Current(t) dest := v2net.UDPDestination(v2net.IPAddress([]byte{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88}), 53) - v2netassert.Destination(dest).IsNotTCP() - v2netassert.Destination(dest).IsUDP() + assert.Destination(dest).IsNotTCP() + assert.Destination(dest).IsUDP() assert.String(dest).Equals("udp:[2001:4860:4860::8888]:53") } diff --git a/common/protocol/raw/commands_test.go b/common/protocol/raw/commands_test.go index 84dae43e3..7a553959e 100644 --- a/common/protocol/raw/commands_test.go +++ b/common/protocol/raw/commands_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/v2ray/v2ray-core/common/alloc" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" "github.com/v2ray/v2ray-core/common/protocol" . "github.com/v2ray/v2ray-core/common/protocol/raw" "github.com/v2ray/v2ray-core/common/uuid" @@ -34,7 +33,7 @@ func TestSwitchAccount(t *testing.T) { assert.Bool(ok).IsTrue() assert.Pointer(sa.Host).IsNil() assert.Pointer(sa2.Host).IsNil() - netassert.Port(sa.Port).Equals(sa2.Port) + assert.Port(sa.Port).Equals(sa2.Port) assert.String(sa.ID).Equals(sa2.ID.String()) assert.Uint16(sa.AlterIds.Value()).Equals(sa2.AlterIds.Value()) assert.Byte(byte(sa.Level)).Equals(byte(sa2.Level)) diff --git a/common/protocol/raw/encoding_test.go b/common/protocol/raw/encoding_test.go index 1b6712939..a8fd2394f 100644 --- a/common/protocol/raw/encoding_test.go +++ b/common/protocol/raw/encoding_test.go @@ -5,7 +5,6 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" "github.com/v2ray/v2ray-core/common/protocol" . "github.com/v2ray/v2ray-core/common/protocol/raw" "github.com/v2ray/v2ray-core/common/uuid" @@ -45,6 +44,6 @@ func TestRequestSerialization(t *testing.T) { assert.Byte(expectedRequest.Version).Equals(actualRequest.Version) assert.Byte(byte(expectedRequest.Command)).Equals(byte(actualRequest.Command)) assert.Byte(byte(expectedRequest.Option)).Equals(byte(actualRequest.Option)) - netassert.Address(expectedRequest.Address).Equals(actualRequest.Address) - netassert.Port(expectedRequest.Port).Equals(actualRequest.Port) + assert.Address(expectedRequest.Address).Equals(actualRequest.Address) + assert.Port(expectedRequest.Port).Equals(actualRequest.Port) } diff --git a/proxy/dokodemo/dokodemo_test.go b/proxy/dokodemo/dokodemo_test.go index 7fa760115..fa84cbaa9 100644 --- a/proxy/dokodemo/dokodemo_test.go +++ b/proxy/dokodemo/dokodemo_test.go @@ -10,7 +10,6 @@ import ( "github.com/v2ray/v2ray-core/app/proxyman" v2net "github.com/v2ray/v2ray-core/common/net" v2nettesting "github.com/v2ray/v2ray-core/common/net/testing" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" . "github.com/v2ray/v2ray-core/proxy/dokodemo" "github.com/v2ray/v2ray-core/proxy/freedom" v2testing "github.com/v2ray/v2ray-core/testing" @@ -57,7 +56,7 @@ func TestDokodemoTCP(t *testing.T) { port := v2nettesting.PickPort() err = dokodemo.Listen(port) assert.Error(err).IsNil() - netassert.Port(port).Equals(dokodemo.Port()) + assert.Port(port).Equals(dokodemo.Port()) tcpClient, err := net.DialTCP("tcp", nil, &net.TCPAddr{ IP: []byte{127, 0, 0, 1}, @@ -115,7 +114,7 @@ func TestDokodemoUDP(t *testing.T) { port := v2nettesting.PickPort() err = dokodemo.Listen(port) assert.Error(err).IsNil() - netassert.Port(port).Equals(dokodemo.Port()) + assert.Port(port).Equals(dokodemo.Port()) udpClient, err := net.DialUDP("udp", nil, &net.UDPAddr{ IP: []byte{127, 0, 0, 1}, @@ -130,6 +129,6 @@ func TestDokodemoUDP(t *testing.T) { response := make([]byte, 1024) nBytes, addr, err := udpClient.ReadFromUDP(response) assert.Error(err).IsNil() - netassert.IP(addr.IP).Equals(v2net.LocalHostIP.IP()) + assert.IP(addr.IP).Equals(v2net.LocalHostIP.IP()) assert.Bytes(response[:nBytes]).Equals([]byte("Processed: " + data2Send)) } diff --git a/proxy/freedom/freedom_test.go b/proxy/freedom/freedom_test.go index e9fa399eb..cd75c75f9 100644 --- a/proxy/freedom/freedom_test.go +++ b/proxy/freedom/freedom_test.go @@ -14,7 +14,6 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" v2nettesting "github.com/v2ray/v2ray-core/common/net/testing" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" . "github.com/v2ray/v2ray-core/proxy/freedom" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" @@ -88,6 +87,6 @@ func TestIPResolution(t *testing.T) { space.Initialize() ipDest := freedom.ResolveIP(v2net.TCPDestination(v2net.DomainAddress("v2ray.com"), v2net.Port(80))) - netassert.Destination(ipDest).IsTCP() - netassert.Address(ipDest.Address()).Equals(v2net.LocalHostIP) + assert.Destination(ipDest).IsTCP() + assert.Address(ipDest.Address()).Equals(v2net.LocalHostIP) } diff --git a/proxy/http/server_test.go b/proxy/http/server_test.go index 4a56a5c39..e3625452e 100644 --- a/proxy/http/server_test.go +++ b/proxy/http/server_test.go @@ -8,7 +8,6 @@ import ( testdispatcher "github.com/v2ray/v2ray-core/app/dispatcher/testing" v2nettesting "github.com/v2ray/v2ray-core/common/net/testing" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" . "github.com/v2ray/v2ray-core/proxy/http" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" @@ -59,7 +58,7 @@ func TestNormalGetRequest(t *testing.T) { port := v2nettesting.PickPort() err := httpProxy.Listen(port) assert.Error(err).IsNil() - netassert.Port(port).Equals(httpProxy.Port()) + assert.Port(port).Equals(httpProxy.Port()) httpClient := &http.Client{} resp, err := httpClient.Get("http://127.0.0.1:" + port.String() + "/") diff --git a/proxy/shadowsocks/protocol_test.go b/proxy/shadowsocks/protocol_test.go index 92d25d7ef..fbcad62fc 100644 --- a/proxy/shadowsocks/protocol_test.go +++ b/proxy/shadowsocks/protocol_test.go @@ -5,7 +5,6 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" "github.com/v2ray/v2ray-core/proxy" . "github.com/v2ray/v2ray-core/proxy/shadowsocks" v2testing "github.com/v2ray/v2ray-core/testing" @@ -21,8 +20,8 @@ func TestNormalRequestParsing(t *testing.T) { request, err := ReadRequest(buffer, nil, false) assert.Error(err).IsNil() - netassert.Address(request.Address).Equals(v2net.LocalHostIP) - netassert.Port(request.Port).Equals(v2net.Port(80)) + assert.Address(request.Address).Equals(v2net.LocalHostIP) + assert.Port(request.Port).Equals(v2net.Port(80)) assert.Bool(request.OTA).IsFalse() } @@ -85,7 +84,7 @@ func TestOTARequest(t *testing.T) { []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5})) request, err := ReadRequest(buffer, auth, false) assert.Error(err).IsNil() - netassert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com")) + assert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com")) assert.Bool(request.OTA).IsTrue() } @@ -110,8 +109,8 @@ func TestUDPRequestParsing(t *testing.T) { request, err := ReadRequest(buffer, nil, true) assert.Error(err).IsNil() - netassert.Address(request.Address).Equals(v2net.LocalHostIP) - netassert.Port(request.Port).Equals(v2net.Port(80)) + assert.Address(request.Address).Equals(v2net.LocalHostIP) + assert.Port(request.Port).Equals(v2net.Port(80)) assert.Bool(request.OTA).IsFalse() assert.Bytes(request.UDPPayload.Value).Equals([]byte{1, 2, 3, 4, 5, 6}) } @@ -130,7 +129,7 @@ func TestUDPRequestWithOTA(t *testing.T) { []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5})) request, err := ReadRequest(buffer, auth, true) assert.Error(err).IsNil() - netassert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com")) + assert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com")) assert.Bool(request.OTA).IsTrue() assert.Bytes(request.UDPPayload.Value).Equals([]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}) diff --git a/proxy/socks/protocol/socks4_test.go b/proxy/socks/protocol/socks4_test.go index 325e859db..a7105f5c7 100644 --- a/proxy/socks/protocol/socks4_test.go +++ b/proxy/socks/protocol/socks4_test.go @@ -6,7 +6,6 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" - v2netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" ) @@ -24,7 +23,7 @@ func TestSocks4AuthenticationRequestRead(t *testing.T) { assert.Error(err).Equals(Socks4Downgrade) assert.Byte(request4.Version).Named("Version").Equals(0x04) assert.Byte(request4.Command).Named("Command").Equals(0x01) - v2netassert.Port(request4.Port).Named("Port").Equals(v2net.Port(53)) + assert.Port(request4.Port).Named("Port").Equals(v2net.Port(53)) assert.Bytes(request4.IP[:]).Named("IP").Equals([]byte{0x72, 0x72, 0x72, 0x72}) } diff --git a/proxy/socks/protocol/socks_test.go b/proxy/socks/protocol/socks_test.go index c361d42f8..68046c729 100644 --- a/proxy/socks/protocol/socks_test.go +++ b/proxy/socks/protocol/socks_test.go @@ -7,7 +7,6 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" - v2netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" "github.com/v2ray/v2ray-core/proxy" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" @@ -71,7 +70,7 @@ func TestRequestRead(t *testing.T) { assert.Byte(request.Command).Named("Command").Equals(0x01) assert.Byte(request.AddrType).Named("Address Type").Equals(0x01) assert.Bytes(request.IPv4[:]).Named("IPv4").Equals([]byte{0x72, 0x72, 0x72, 0x72}) - v2netassert.Port(request.Port).Named("Port").Equals(v2net.Port(53)) + assert.Port(request.Port).Named("Port").Equals(v2net.Port(53)) } func TestResponseWrite(t *testing.T) { @@ -170,5 +169,5 @@ func TestIPv6Request(t *testing.T) { assert.Error(err).IsNil() assert.Byte(request.Command).Equals(1) assert.Bytes(request.IPv6[:]).Equals([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}) - v2netassert.Port(request.Port).Equals(8) + assert.Port(request.Port).Equals(8) } diff --git a/proxy/socks/protocol/udp_test.go b/proxy/socks/protocol/udp_test.go index 0b5f3f13d..152aadfb2 100644 --- a/proxy/socks/protocol/udp_test.go +++ b/proxy/socks/protocol/udp_test.go @@ -4,7 +4,6 @@ import ( "testing" v2net "github.com/v2ray/v2ray-core/common/net" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" "github.com/v2ray/v2ray-core/transport" @@ -34,6 +33,6 @@ func TestDomainAddressRequest(t *testing.T) { assert.Byte(request.Fragment).Equals(1) assert.String(request.Address).Equals("v2ray.com") - netassert.Port(request.Port).Equals(v2net.Port(80)) + assert.Port(request.Port).Equals(v2net.Port(80)) assert.Bytes(request.Data.Value).Equals([]byte("Actual payload")) } diff --git a/shell/point/config_json_test.go b/shell/point/config_json_test.go index 3591511c8..a2cdb4f3c 100644 --- a/shell/point/config_json_test.go +++ b/shell/point/config_json_test.go @@ -9,7 +9,6 @@ import ( "testing" _ "github.com/v2ray/v2ray-core/app/router/rules" - netassert "github.com/v2ray/v2ray-core/common/net/testing/assert" . "github.com/v2ray/v2ray-core/shell/point" v2testing "github.com/v2ray/v2ray-core/testing" @@ -25,7 +24,7 @@ func TestClientSampleConfig(t *testing.T) { pointConfig, err := LoadConfig(filepath.Join(baseDir, "vpoint_socks_vmess.json")) assert.Error(err).IsNil() - netassert.Port(pointConfig.Port).IsValid() + assert.Port(pointConfig.Port).IsValid() assert.Pointer(pointConfig.InboundConfig).IsNotNil() assert.Pointer(pointConfig.OutboundConfig).IsNotNil() @@ -45,7 +44,7 @@ func TestServerSampleConfig(t *testing.T) { pointConfig, err := LoadConfig(filepath.Join(baseDir, "vpoint_vmess_freedom.json")) assert.Error(err).IsNil() - netassert.Port(pointConfig.Port).IsValid() + assert.Port(pointConfig.Port).IsValid() assert.Pointer(pointConfig.InboundConfig).IsNotNil() assert.Pointer(pointConfig.OutboundConfig).IsNotNil() diff --git a/common/net/testing/assert/address.go b/testing/assert/address.go similarity index 96% rename from common/net/testing/assert/address.go rename to testing/assert/address.go index 17730d11e..4e2729b64 100644 --- a/common/net/testing/assert/address.go +++ b/testing/assert/address.go @@ -3,7 +3,6 @@ package assert import ( v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/common/serial" - "github.com/v2ray/v2ray-core/testing/assert" ) func Address(value v2net.Address) *AddressSubject { @@ -11,7 +10,7 @@ func Address(value v2net.Address) *AddressSubject { } type AddressSubject struct { - assert.Subject + Subject value v2net.Address } diff --git a/common/net/testing/assert/destination.go b/testing/assert/destination.go similarity index 94% rename from common/net/testing/assert/destination.go rename to testing/assert/destination.go index aa75aa014..4308857c1 100644 --- a/common/net/testing/assert/destination.go +++ b/testing/assert/destination.go @@ -3,7 +3,6 @@ package assert import ( v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/common/serial" - "github.com/v2ray/v2ray-core/testing/assert" ) func Destination(value v2net.Destination) *DestinationSubject { @@ -11,7 +10,7 @@ func Destination(value v2net.Destination) *DestinationSubject { } type DestinationSubject struct { - assert.Subject + Subject value v2net.Destination } diff --git a/common/net/testing/assert/ip.go b/testing/assert/ip.go similarity index 92% rename from common/net/testing/assert/ip.go rename to testing/assert/ip.go index ea56090e8..edb3ddfba 100644 --- a/common/net/testing/assert/ip.go +++ b/testing/assert/ip.go @@ -5,7 +5,6 @@ import ( "net" "github.com/v2ray/v2ray-core/common/serial" - "github.com/v2ray/v2ray-core/testing/assert" ) func IP(value net.IP) *IPSubject { @@ -13,7 +12,7 @@ func IP(value net.IP) *IPSubject { } type IPSubject struct { - assert.Subject + Subject value net.IP } diff --git a/common/net/testing/assert/port.go b/testing/assert/port.go similarity index 95% rename from common/net/testing/assert/port.go rename to testing/assert/port.go index 19378bce9..f9ead7278 100644 --- a/common/net/testing/assert/port.go +++ b/testing/assert/port.go @@ -3,7 +3,6 @@ package assert import ( v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/common/serial" - "github.com/v2ray/v2ray-core/testing/assert" ) func Port(value v2net.Port) *PortSubject { @@ -11,7 +10,7 @@ func Port(value v2net.Port) *PortSubject { } type PortSubject struct { - assert.Subject + Subject value v2net.Port }