Test_WithContextCaller runs serially because it mutates the package-global logger and output to verify caller attribution.
(t *testing.T)
| 55 | // Test_WithContextCaller runs serially because it mutates the package-global |
| 56 | // logger and output to verify caller attribution. |
| 57 | func Test_WithContextCaller(t *testing.T) { |
| 58 | t.Cleanup(initDefaultLogger) |
| 59 | |
| 60 | logger = &defaultLogger{ |
| 61 | stdlog: log.New(os.Stderr, "", log.Lshortfile), |
| 62 | depth: 4, |
| 63 | } |
| 64 | |
| 65 | var w byteSliceWriter |
| 66 | SetOutput(&w) |
| 67 | ctx := context.TODO() |
| 68 | |
| 69 | withContextLine := callSiteLine(t) + 1 |
| 70 | WithContext(ctx).Info("") |
| 71 | infoLine := callSiteLine(t) + 1 |
| 72 | Info("") |
| 73 | |
| 74 | expectCallerOutput(t, &w, withContextLine, infoLine) |
| 75 | } |
| 76 | |
| 77 | // Test_WithContextNilCaller runs serially because it mutates the package-global |
| 78 | // logger and output to verify caller attribution. |
nothing calls this directly
no test coverage detected
searching dependent graphs…