测试率达到82.9%

This commit is contained in:
jroam 2019-04-11 09:47:51 +08:00
parent 2534655bc8
commit cd719f134d
6 changed files with 7 additions and 5 deletions

View File

@ -11,6 +11,7 @@ func TestSearch(t *testing.T) {
gtest.Case(t, func(){ gtest.Case(t, func(){
var( var(
paths1 string ="./testfile/dirfiles" paths1 string ="./testfile/dirfiles"
paths2 string ="./testfile/dirfiles_no"
tpath string tpath string
tpath2 string tpath2 string
tempstr string tempstr string
@ -32,7 +33,7 @@ func TestSearch(t *testing.T) {
//测试当前目录
tempstr,_=filepath.Abs("./") tempstr,_=filepath.Abs("./")
paths1=tempstr+paths1 paths1=tempstr+paths1
paths1=filepath.ToSlash(paths1) paths1=filepath.ToSlash(paths1)
@ -43,7 +44,9 @@ func TestSearch(t *testing.T) {
gtest.Assert(tpath2,paths1) gtest.Assert(tpath2,paths1)
//测试目录不存在时
_,err=Search(paths2)
gtest.AssertNE(err,nil)

View File

@ -9,14 +9,14 @@ import (
func TestMTime(t *testing.T) { func TestMTime(t *testing.T) {
gtest.Case(t, func() { gtest.Case(t, func() {
gtest.Assert(MTime("./testfile/dirfiles/t1.txt"),1554899730) gtest.Assert(MTime("./testfile/dirfiles/t1.txt"),1554883732)
gtest.Assert(MTime(""),0) gtest.Assert(MTime(""),0)
}) })
} }
func TestMTimeMillisecond(t *testing.T) { func TestMTimeMillisecond(t *testing.T) {
gtest.Case(t, func() { gtest.Case(t, func() {
gtest.Assert(MTimeMillisecond("./testfile/dirfiles/t1.txt"),102) gtest.Assert(MTimeMillisecond("./testfile/dirfiles/t1.txt"),129)
gtest.Assert(MTimeMillisecond(""),0) gtest.Assert(MTimeMillisecond(""),0)
}) })
} }

View File

@ -1 +0,0 @@
hello