MCPcopy
hub / github.com/pterm/pterm / testSprintContainsWithoutError

Function testSprintContainsWithoutError

utils_test.go:119–134  ·  view source on GitHub ↗

testSprintContainsWithoutError can be used to test Sprint methods which return an error.

(t *testing.T, logic func(a any) (string, error))

Source from the content-addressed store, hash-verified

117
118// testSprintContainsWithoutError can be used to test Sprint methods which return an error.
119func testSprintContainsWithoutError(t *testing.T, logic func(a any) (string, error)) {
120 for _, printable := range printables {
121 t.Run(fmt.Sprint(printable), func(t *testing.T) {
122 s, err := logic(printable)
123 testza.AssertContains(t, s, fmt.Sprint(printable))
124 testza.AssertNoError(t, err)
125 })
126 pterm.DisableStyling()
127 t.Run(fmt.Sprint(printable), func(t *testing.T) {
128 s, err := logic(printable)
129 testza.AssertContains(t, s, fmt.Sprint(printable))
130 testza.AssertNoError(t, err)
131 })
132 pterm.EnableStyling()
133 }
134}
135
136// testSprintfContains can be used to test Sprintf methods.
137func testSprintfContains(t *testing.T, logic func(format string, a any) string) {

Callers 1

Calls 3

DisableStylingFunction · 0.92
EnableStylingFunction · 0.92
SprintMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…