MCPcopy Index your code
hub / github.com/github/gh-aw / TestConsoleFormatWarningMessageUsage

Function TestConsoleFormatWarningMessageUsage

pkg/cli/error_formatting_test.go:122–156  ·  view source on GitHub ↗

TestConsoleFormatWarningMessageUsage verifies console.FormatWarningMessage is used correctly

(t *testing.T)

Source from the content-addressed store, hash-verified

120
121// TestConsoleFormatWarningMessageUsage verifies console.FormatWarningMessage is used correctly
122func TestConsoleFormatWarningMessageUsage(t *testing.T) {
123 tests := []struct {
124 name string
125 message string
126 shouldContain []string
127 }{
128 {
129 name: "simple warning",
130 message: "This is a warning",
131 shouldContain: []string{
132 "This is a warning",
133 },
134 },
135 {
136 name: "warning with details",
137 message: "Failed to cleanup: directory not empty",
138 shouldContain: []string{
139 "Failed to cleanup",
140 "directory not empty",
141 },
142 },
143 }
144
145 for _, tt := range tests {
146 t.Run(tt.name, func(t *testing.T) {
147 formatted := console.FormatWarningMessage(tt.message)
148
149 // Verify the formatted message contains the original text
150 for _, expected := range tt.shouldContain {
151 assert.Contains(t, formatted, expected,
152 "Formatted message should contain: %s", expected)
153 }
154 })
155 }
156}
157
158// TestErrorMessagePatterns verifies common error message patterns include helpful context
159func TestErrorMessagePatterns(t *testing.T) {

Callers

nothing calls this directly

Calls 2

FormatWarningMessageFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected