(t *testing.T)
| 263 | } |
| 264 | |
| 265 | func TestValidateOutputFormat(t *testing.T) { |
| 266 | tests := []struct { |
| 267 | name string |
| 268 | input string |
| 269 | wantFormat TraceOutputFormat |
| 270 | wantErr bool |
| 271 | }{ |
| 272 | // Valid cases |
| 273 | { |
| 274 | name: "table", |
| 275 | input: "table", |
| 276 | wantFormat: TraceOutputTable, |
| 277 | wantErr: false, |
| 278 | }, |
| 279 | { |
| 280 | name: "json", |
| 281 | input: "json", |
| 282 | wantFormat: TraceOutputJSON, |
| 283 | wantErr: false, |
| 284 | }, |
| 285 | { |
| 286 | name: "empty defaults to table", |
| 287 | input: "", |
| 288 | wantFormat: TraceOutputTable, |
| 289 | wantErr: false, |
| 290 | }, |
| 291 | // Invalid cases |
| 292 | { |
| 293 | name: "invalid - yaml", |
| 294 | input: "yaml", |
| 295 | wantFormat: "", |
| 296 | wantErr: true, |
| 297 | }, |
| 298 | { |
| 299 | name: "invalid - xml", |
| 300 | input: "xml", |
| 301 | wantFormat: "", |
| 302 | wantErr: true, |
| 303 | }, |
| 304 | { |
| 305 | name: "invalid - random", |
| 306 | input: "notaformat", |
| 307 | wantFormat: "", |
| 308 | wantErr: true, |
| 309 | }, |
| 310 | { |
| 311 | name: "invalid - TABLE uppercase", |
| 312 | input: "TABLE", |
| 313 | wantFormat: "", |
| 314 | wantErr: true, |
| 315 | }, |
| 316 | { |
| 317 | name: "invalid - JSON uppercase", |
| 318 | input: "JSON", |
| 319 | wantFormat: "", |
| 320 | wantErr: true, |
| 321 | }, |
| 322 | // Security: injection attempts |
nothing calls this directly
no test coverage detected