MCPcopy Create free account
hub / github.com/stretchr/testify / labeledOutput

Function labeledOutput

assert/assertions.go:388–400  ·  view source on GitHub ↗

labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner: \t{{label}}:{{align_spaces}}\t{{content}}\n The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the

(content ...labeledContent)

Source from the content-addressed store, hash-verified

386//
387// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.
388func labeledOutput(content ...labeledContent) string {
389 longestLabel := 0
390 for _, v := range content {
391 if len(v.label) > longestLabel {
392 longestLabel = len(v.label)
393 }
394 }
395 var output string
396 for _, v := range content {
397 output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n"
398 }
399 return output
400}
401
402// Implements asserts that an object is implemented by the specified interface.
403//

Callers 1

FailFunction · 0.85

Calls 1

indentMessageLinesFunction · 0.85

Tested by

no test coverage detected