mirror of
https://gitee.com/johng/gf.git
synced 2024-12-03 20:58:47 +08:00
测试率达到82.9%
This commit is contained in:
parent
2534655bc8
commit
cd719f134d
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
hello
|
|
Loading…
Reference in New Issue
Block a user