MCPcopy
hub / github.com/pterm/pterm / testSprintContains

Function testSprintContains

utils_test.go:105–116  ·  view source on GitHub ↗

testSprintContains can be used to test Sprint methods.

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

Source from the content-addressed store, hash-verified

103
104// testSprintContains can be used to test Sprint methods.
105func testSprintContains(t *testing.T, logic func(a any) string) {
106 for _, printable := range printables {
107 t.Run(fmt.Sprint(printable), func(t *testing.T) {
108 testza.AssertContains(t, logic(printable), fmt.Sprint(printable))
109 })
110 pterm.DisableStyling()
111 t.Run(fmt.Sprint(printable), func(t *testing.T) {
112 testza.AssertContains(t, logic(printable), fmt.Sprint(printable))
113 })
114 pterm.EnableStyling()
115 }
116}
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)) {

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…