MCPcopy Create free account
hub / github.com/github/gh-aw / TestFormatCompilerMessage

Function TestFormatCompilerMessage

pkg/workflow/compiler_error_formatting_test.go:140–181  ·  view source on GitHub ↗

TestFormatCompilerMessage tests the formatCompilerMessage helper function

(t *testing.T)

Source from the content-addressed store, hash-verified

138
139// TestFormatCompilerMessage tests the formatCompilerMessage helper function
140func TestFormatCompilerMessage(t *testing.T) {
141 tests := []struct {
142 name string
143 filePath string
144 msgType string
145 message string
146 wantContain []string
147 }{
148 {
149 name: "warning message",
150 filePath: "/path/to/workflow.md",
151 msgType: "warning",
152 message: "container image validation failed",
153 wantContain: []string{
154 "/path/to/workflow.md",
155 "warning",
156 "container image validation failed",
157 },
158 },
159 {
160 name: "error message as string",
161 filePath: "test.md",
162 msgType: "error",
163 message: "validation error",
164 wantContain: []string{
165 "test.md",
166 "error",
167 "validation error",
168 },
169 },
170 }
171
172 for _, tt := range tests {
173 t.Run(tt.name, func(t *testing.T) {
174 msg := formatCompilerMessage(tt.filePath, tt.msgType, tt.message)
175
176 for _, want := range tt.wantContain {
177 assert.Contains(t, msg, want, "Message should contain: %s", want)
178 }
179 })
180 }
181}
182
183// TestFormatCompilerError_ErrorWrapping verifies that error wrapping preserves error chains
184func TestFormatCompilerError_ErrorWrapping(t *testing.T) {

Callers

nothing calls this directly

Calls 2

formatCompilerMessageFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected