mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-12 22:42:18 +00:00
simplify testing
This commit is contained in:
1 parent
3582b9d869
commit
fc63f0432c
99 files changed
+726
-817
No files matched your search
@@ -6,7 +6,6 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
@@ -32,7 +31,7 @@ func allFilesExists(files ...string) bool {
|
||||
}
|
||||
|
||||
func TestBuildMacOS(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
binPath = filepath.Join(os.Getenv("GOPATH"), "testing")
|
||||
cleanBinPath()
|
||||
|
||||
|
||||
@@ -3,12 +3,11 @@ package main
|
||||
import (
|
||||
"testing"
|
||||
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func TestParseOS(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
assert.Pointer(parseOS("windows")).Equals(Windows)
|
||||
assert.Pointer(parseOS("macos")).Equals(MacOS)
|
||||
@@ -17,7 +16,7 @@ func TestParseOS(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseArch(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
assert.Pointer(parseArch("x86")).Equals(X86)
|
||||
assert.Pointer(parseArch("x64")).Equals(Amd64)
|
||||
|
||||
@@ -10,12 +10,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func TestBuildAndRun(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
gopath := os.Getenv("GOPATH")
|
||||
goOS := parseOS(runtime.GOOS)
|
||||
@@ -42,7 +41,7 @@ func TestBuildAndRun(t *testing.T) {
|
||||
errStr := string(errBuffer.Bytes())
|
||||
|
||||
assert.Bool(strings.Contains(outStr, "v1.0")).IsTrue()
|
||||
assert.StringLiteral(errStr).Equals("")
|
||||
assert.String(errStr).Equals("")
|
||||
|
||||
os.Remove(target)
|
||||
}
|
||||
Reference in new issue
Block a user