From ff9bbf0a490cc3918c40ddea623c33969be330b1 Mon Sep 17 00:00:00 2001 From: jroam Date: Mon, 15 Apr 2019 11:41:05 +0800 Subject: [PATCH] edit test --- .travis.yml | 29 ++++++++++++++--------------- g/os/gfile/gfile_contents_test.go | 8 +++----- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index ce9193eb3..a645ca541 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,40 @@ language: go go: - - "1.10.x" - - "1.11.x" - - "1.12.x" +- "1.10.x" +- "1.11.x" +- "1.12.x" branches: + only: - master - develop - test_gfile env: - - GO111MODULE=on +- GO111MODULE=on services: - - mysql - - redis-server +- mysql +- redis-server addons: hosts: - - local + - local before_install: - - pwd - - go get -u github.com/gogf/gf +- pwd install: - - cat /etc/hosts +- cat /etc/hosts script: - - cd g - - go get -u github.com/gogf/gf - - GOARCH=386 go test -v ./... - - GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic +- cd g +- GOARCH=386 go test -v ./... +- GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic after_success: - - bash <(curl -s https://codecov.io/bash) +- bash <(curl -s https://codecov.io/bash) diff --git a/g/os/gfile/gfile_contents_test.go b/g/os/gfile/gfile_contents_test.go index a7c3e8c09..2a352a1bc 100644 --- a/g/os/gfile/gfile_contents_test.go +++ b/g/os/gfile/gfile_contents_test.go @@ -18,7 +18,7 @@ func CreateTestFile(filename, content string) error { //测试完删除文件或目录 func DelTestFiles(filenames string) { - os.RemoveAll(Testpath()+filenames) + os.RemoveAll(Testpath() + filenames) } //创建目录 @@ -46,13 +46,12 @@ func Formatpath(paths string) string { //指定返回要测试的目录 func Testpath() string { - psths,err:= filepath.Abs("./") - if err!=nil{ + psths, err := filepath.Abs("./") + if err != nil { return os.TempDir() } return strings.Replace(psths, "./", "/", 1) - } func TestGetContents(t *testing.T) { @@ -67,7 +66,6 @@ func TestGetContents(t *testing.T) { gtest.Assert(GetContents(Testpath()+filepaths), "my name is jroam") gtest.Assert(GetContents(""), "") - }) }