mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-24 15:18:44 +00:00
simplify testing
This commit is contained in:
1 parent
3582b9d869
commit
fc63f0432c
99 files changed
+726
-817
No files matched your search
@@ -8,12 +8,11 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/v2ray/v2ray-core/common/net"
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func TestIPParsing(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
rawJson := "\"8.8.8.8\""
|
||||
var address AddressJson
|
||||
@@ -25,7 +24,7 @@ func TestIPParsing(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDomainParsing(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
rawJson := "\"v2ray.com\""
|
||||
var address AddressJson
|
||||
@@ -33,11 +32,11 @@ func TestDomainParsing(t *testing.T) {
|
||||
assert.Error(err).IsNil()
|
||||
assert.Bool(address.Address.IsIPv4()).IsFalse()
|
||||
assert.Bool(address.Address.IsDomain()).IsTrue()
|
||||
assert.StringLiteral(address.Address.Domain()).Equals("v2ray.com")
|
||||
assert.String(address.Address.Domain()).Equals("v2ray.com")
|
||||
}
|
||||
|
||||
func TestInvalidAddressJson(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
rawJson := "1234"
|
||||
var address AddressJson
|
||||
|
||||
Reference in new issue
Block a user