expectCallerOutput asserts that w contains exactly two log lines, the first emitted from withContextLine and the second from infoLine, both annotated with default_test.go via the standard library's Lshortfile flag.
(t *testing.T, w *byteSliceWriter, withContextLine, infoLine int)
| 47 | // emitted from withContextLine and the second from infoLine, both annotated |
| 48 | // with default_test.go via the standard library's Lshortfile flag. |
| 49 | func expectCallerOutput(t *testing.T, w *byteSliceWriter, withContextLine, infoLine int) { |
| 50 | t.Helper() |
| 51 | want := fmt.Sprintf("default_test.go:%d: [Info] \ndefault_test.go:%d: [Info] \n", withContextLine, infoLine) |
| 52 | require.Equal(t, want, string(w.b), "log output should attribute the WithContext call site (line %d) and the bare Info call site (line %d)", withContextLine, infoLine) |
| 53 | } |
| 54 | |
| 55 | // Test_WithContextCaller runs serially because it mutates the package-global |
| 56 | // logger and output to verify caller attribution. |
no outgoing calls
no test coverage detected