(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestNewLogFile(t *testing.T) { |
| 67 | defer func() { |
| 68 | os.RemoveAll("Log/") |
| 69 | }() |
| 70 | InitLog(InfoLog, PATH, Stdout) |
| 71 | logfileNum1, err1 := ioutil.ReadDir("Log/") |
| 72 | if err1 != nil { |
| 73 | fmt.Println(err1) |
| 74 | return |
| 75 | } |
| 76 | logPrint() |
| 77 | isNeedNewFile := CheckIfNeedNewFile() |
| 78 | assert.NotEqual(t, isNeedNewFile, true) |
| 79 | ClosePrintLog() |
| 80 | time.Sleep(time.Second * 2) |
| 81 | InitLog(InfoLog, PATH, Stdout) |
| 82 | logfileNum2, err2 := ioutil.ReadDir("Log/") |
| 83 | if err2 != nil { |
| 84 | fmt.Println(err2) |
| 85 | return |
| 86 | } |
| 87 | assert.Equal(t, len(logfileNum1), (len(logfileNum2) - 1)) |
| 88 | } |
nothing calls this directly
no test coverage detected