MCPcopy
hub / github.com/gofiber/fiber / expectCallerOutput

Function expectCallerOutput

log/default_test.go:49–53  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

47// emitted from withContextLine and the second from infoLine, both annotated
48// with default_test.go via the standard library's Lshortfile flag.
49func 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.

Callers 2

Test_WithContextCallerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected