mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-13 22:45:13 +00:00
simplify testing
This commit is contained in:
1 parent
3582b9d869
commit
fc63f0432c
99 files changed
+726
-817
No files matched your search
@@ -4,13 +4,12 @@ import (
|
||||
"testing"
|
||||
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
"github.com/v2ray/v2ray-core/transport"
|
||||
)
|
||||
|
||||
func TestSingleByteUDPRequest(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
request, err := ReadUDPRequest(make([]byte, 1))
|
||||
if request != nil {
|
||||
@@ -20,7 +19,7 @@ func TestSingleByteUDPRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDomainAddressRequest(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
payload := make([]byte, 0, 1024)
|
||||
payload = append(payload, 0, 0, 1, AddrTypeDomain, byte(len("v2ray.com")))
|
||||
@@ -32,7 +31,7 @@ func TestDomainAddressRequest(t *testing.T) {
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
assert.Byte(request.Fragment).Equals(1)
|
||||
assert.String(request.Address).Equals("v2ray.com")
|
||||
assert.Address(request.Address).EqualsString("v2ray.com")
|
||||
assert.Port(request.Port).Equals(v2net.Port(80))
|
||||
assert.Bytes(request.Data.Value).Equals([]byte("Actual payload"))
|
||||
}
|
||||
Reference in new issue
Block a user