1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 13:19:37 -05:00

Make testlogger output "TestLogger" prefix (#24683)

Make testlogger output "TestLogger" prefix instead of "Unknown Test"
when there is no running test case.
This commit is contained in:
wxiaoguang 2023-05-12 22:20:29 +08:00 committed by GitHub
parent a7773d28d2
commit bfa0fc2c98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,9 @@ func (w *testLoggerWriterCloser) Write(p []byte) (int, error) {
}
if t == nil || *t == nil {
return fmt.Fprintf(os.Stdout, "??? [Unknown Test] %s\n", p)
// if there is no running test, the log message should be outputted to console, to avoid losing important information.
// the "???" prefix is used to match the "===" and "+++" in PrintCurrentTest
return fmt.Fprintf(os.Stdout, "??? [TestLogger] %s\n", p)
}
defer func() {