(t *testing.T)
| 240 | } |
| 241 | |
| 242 | func TestFormatErrorMessage(t *testing.T) { |
| 243 | tests := []struct { |
| 244 | name string |
| 245 | message string |
| 246 | expected string |
| 247 | }{ |
| 248 | { |
| 249 | name: "simple error", |
| 250 | message: "File not found", |
| 251 | expected: "File not found", |
| 252 | }, |
| 253 | { |
| 254 | name: "detailed error", |
| 255 | message: "failed to compile workflow: invalid syntax at line 15", |
| 256 | expected: "failed to compile workflow: invalid syntax at line 15", |
| 257 | }, |
| 258 | { |
| 259 | name: "empty error message", |
| 260 | message: "", |
| 261 | expected: "", |
| 262 | }, |
| 263 | { |
| 264 | name: "error with code", |
| 265 | message: "exit code 1: command failed", |
| 266 | expected: "exit code 1: command failed", |
| 267 | }, |
| 268 | } |
| 269 | |
| 270 | for _, tt := range tests { |
| 271 | t.Run(tt.name, func(t *testing.T) { |
| 272 | result := FormatErrorMessage(tt.message) |
| 273 | |
| 274 | // Should contain the X emoji prefix |
| 275 | if !strings.Contains(result, "✗") { |
| 276 | t.Errorf("FormatErrorMessage() should contain ✗ prefix") |
| 277 | } |
| 278 | |
| 279 | // Should contain the error message text |
| 280 | if !strings.Contains(result, tt.expected) { |
| 281 | t.Errorf("FormatErrorMessage() = %v, should contain %v", result, tt.expected) |
| 282 | } |
| 283 | }) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | func TestFormatSectionHeader(t *testing.T) { |
| 288 | tests := []struct { |
nothing calls this directly
no test coverage detected