| 464 | } |
| 465 | |
| 466 | func TestValidationResult_IsValid(t *testing.T) { |
| 467 | tests := []struct { |
| 468 | name string |
| 469 | result *ValidationResult |
| 470 | wantValid bool |
| 471 | }{ |
| 472 | { |
| 473 | name: "no issues", |
| 474 | result: &ValidationResult{}, |
| 475 | wantValid: true, |
| 476 | }, |
| 477 | { |
| 478 | name: "only warnings", |
| 479 | result: &ValidationResult{ |
| 480 | Warnings: 3, |
| 481 | }, |
| 482 | wantValid: true, |
| 483 | }, |
| 484 | { |
| 485 | name: "has errors", |
| 486 | result: &ValidationResult{ |
| 487 | Errors: 1, |
| 488 | }, |
| 489 | wantValid: false, |
| 490 | }, |
| 491 | { |
| 492 | name: "errors and warnings", |
| 493 | result: &ValidationResult{ |
| 494 | Errors: 1, |
| 495 | Warnings: 2, |
| 496 | }, |
| 497 | wantValid: false, |
| 498 | }, |
| 499 | } |
| 500 | |
| 501 | for _, tt := range tests { |
| 502 | t.Run(tt.name, func(t *testing.T) { |
| 503 | if got := tt.result.IsValid(); got != tt.wantValid { |
| 504 | t.Errorf("IsValid() = %v, want %v", got, tt.wantValid) |
| 505 | } |
| 506 | }) |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | func TestValidate_ComplexScenario(t *testing.T) { |
| 511 | // Create a complex scenario with multiple issues |