TestLoggerV2PrintFuncAllDiscard tests that discard loggers don't log.
(t *testing.T)
| 189 | |
| 190 | // TestLoggerV2PrintFuncAllDiscard tests that discard loggers don't log. |
| 191 | func TestLoggerV2PrintFuncAllDiscard(t *testing.T) { |
| 192 | logger := NewLoggerV2(io.Discard, io.Discard, io.Discard, LoggerV2Config{}) |
| 193 | loggerTp := logger.(*loggerT) |
| 194 | |
| 195 | sprintf = makeSprintfErr(t) |
| 196 | sprint = makeSprintErr(t) |
| 197 | sprintln = makeSprintErr(t) |
| 198 | |
| 199 | // test that printFunc doesn't call the log func on discard loggers |
| 200 | // makeLogFuncErr will fail the test if it's called |
| 201 | loggerTp.output(infoLog, logFuncStr) |
| 202 | loggerTp.output(warningLog, logFuncStr) |
| 203 | loggerTp.output(errorLog, logFuncStr) |
| 204 | |
| 205 | sprintf = fmt.Sprintf |
| 206 | sprint = fmt.Sprint |
| 207 | sprintln = fmt.Sprintln |
| 208 | } |
| 209 | |
| 210 | func TestLoggerV2PrintFuncAllCombinations(t *testing.T) { |
| 211 | const ( |
nothing calls this directly
no test coverage detected