chore: improve codecov (#1878)

This commit is contained in:
Kevin Wan
2022-05-08 13:17:48 +08:00
committed by GitHub
parent 5451d96a81
commit 6d2b9fd904
3 changed files with 66 additions and 5 deletions

View File

@@ -124,18 +124,27 @@ func TestWritePlainAny(t *testing.T) {
assert.Contains(t, buf.String(), "foo")
buf.Reset()
writePlainAny(nil, levelInfo, make(chan int))
writePlainAny(nil, levelError, make(chan int))
assert.Contains(t, buf.String(), "unsupported type")
writePlainAny(nil, levelInfo, 100)
writePlainAny(nil, levelSlow, 100)
assert.Contains(t, buf.String(), "100")
buf.Reset()
writePlainAny(hardToWriteWriter{}, levelInfo, 100)
writePlainAny(hardToWriteWriter{}, levelStat, 100)
assert.Contains(t, buf.String(), "write error")
buf.Reset()
writePlainAny(hardToWriteWriter{}, levelInfo, "foo")
writePlainAny(hardToWriteWriter{}, levelSevere, "foo")
assert.Contains(t, buf.String(), "write error")
buf.Reset()
writePlainAny(hardToWriteWriter{}, levelAlert, "foo")
assert.Contains(t, buf.String(), "write error")
buf.Reset()
writePlainAny(hardToWriteWriter{}, levelFatal, "foo")
assert.Contains(t, buf.String(), "write error")
}
type mockedEntry struct {