MCPcopy
hub / github.com/pterm/pterm / TestStylePrinterPrintMethods

Function TestStylePrinterPrintMethods

color_test.go:15–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestStylePrinterPrintMethods(t *testing.T) {
16 p := pterm.NewStyle(pterm.FgRed, pterm.BgBlue, pterm.Bold)
17
18 t.Run("Print", func(t *testing.T) {
19 testPrintContains(t, func(w io.Writer, a any) {
20 p.Print(a)
21 })
22 })
23
24 t.Run("Printf", func(t *testing.T) {
25 testPrintfContains(t, func(w io.Writer, format string, a any) {
26 p.Printf(format, a)
27 })
28 })
29
30 t.Run("Printfln", func(t *testing.T) {
31 testPrintflnContains(t, func(w io.Writer, format string, a any) {
32 p.Printfln(format, a)
33 })
34 })
35
36 t.Run("Println", func(t *testing.T) {
37 testPrintlnContains(t, func(w io.Writer, a any) {
38 p.Println(a)
39 })
40 })
41
42 t.Run("Sprint", func(t *testing.T) {
43 testSprintContains(t, func(a any) string {
44 return p.Sprint(a)
45 })
46 })
47
48 t.Run("Sprintf", func(t *testing.T) {
49 testSprintfContains(t, func(format string, a any) string {
50 return p.Sprintf(format, a)
51 })
52 })
53
54 t.Run("Sprintfln", func(t *testing.T) {
55 testSprintflnContains(t, func(format string, a any) string {
56 return p.Sprintfln(format, a)
57 })
58 })
59
60 t.Run("Sprintln", func(t *testing.T) {
61 testSprintlnContains(t, func(a any) string {
62 return p.Sprintln(a)
63 })
64 })
65}
66
67func TestRemoveColorFromString(t *testing.T) {
68 for _, randomString := range internal.RandomStrings {

Callers

nothing calls this directly

Calls 15

PrintMethod · 0.95
PrintfMethod · 0.95
PrintflnMethod · 0.95
PrintlnMethod · 0.95
SprintMethod · 0.95
SprintfMethod · 0.95
SprintflnMethod · 0.95
SprintlnMethod · 0.95
NewStyleFunction · 0.92
testPrintContainsFunction · 0.85
testPrintfContainsFunction · 0.85
testPrintflnContainsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…