mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-07-29 03:03:50 -04:00
remove dependency of assert lib
This commit is contained in:
@@ -5,14 +5,12 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
. "v2ray.com/core/proxy/blackhole"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestHTTPResponse(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
buffer := buf.New()
|
||||
|
||||
httpResponse := new(HTTPResponse)
|
||||
@@ -20,6 +18,8 @@ func TestHTTPResponse(t *testing.T) {
|
||||
|
||||
reader := bufio.NewReader(buffer)
|
||||
response, err := http.ReadResponse(reader, nil)
|
||||
assert(err, IsNil)
|
||||
assert(response.StatusCode, Equals, 403)
|
||||
common.Must(err)
|
||||
if response.StatusCode != 403 {
|
||||
t.Error("expected status code 403, but got ", response.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
. "v2ray.com/core/proxy/vmess/encoding"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
|
||||
func TestFnvAuth(t *testing.T) {
|
||||
assert := With(t)
|
||||
fnvAuth := new(FnvAuthenticator)
|
||||
|
||||
expectedText := make([]byte, 256)
|
||||
@@ -20,7 +20,8 @@ func TestFnvAuth(t *testing.T) {
|
||||
buffer := make([]byte, 512)
|
||||
b := fnvAuth.Seal(buffer[:0], nil, expectedText, nil)
|
||||
b, err = fnvAuth.Open(buffer[:0], nil, b, nil)
|
||||
assert(err, IsNil)
|
||||
assert(len(b), Equals, 256)
|
||||
assert(b, Equals, expectedText)
|
||||
common.Must(err)
|
||||
if r := cmp.Diff(b, expectedText); r != "" {
|
||||
t.Error(r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user