improve unit testing case of error logging for ghttp.Server

This commit is contained in:
John
2020-04-28 15:21:17 +08:00
parent 6e7224e306
commit 1eeeeb853e

View File

@ -52,11 +52,11 @@ func Test_Log(t *testing.T) {
t.Assert(gstr.Contains(gfile.GetContents(logPath1), "HANDLER"), true)
logPath2 := gfile.Join(logDir, "access-"+gtime.Now().Format("Ymd")+".log")
fmt.Println(gfile.GetContents(logPath2))
//fmt.Println(gfile.GetContents(logPath2))
t.Assert(gstr.Contains(gfile.GetContents(logPath2), " /hello "), true)
logPath3 := gfile.Join(logDir, "error-"+gtime.Now().Format("Ymd")+".log")
t.Assert(gstr.Contains(gfile.GetContents(logPath3), "[ERRO]"), true)
//fmt.Println(gfile.GetContents(logPath3))
t.Assert(gstr.Contains(gfile.GetContents(logPath3), "custom error"), true)
})
}