TestValidator_NonExistentFile tests handling of non-existent files
(t *testing.T)
| 439 | |
| 440 | // TestValidator_NonExistentFile tests handling of non-existent files |
| 441 | func TestValidator_NonExistentFile(t *testing.T) { |
| 442 | var outBuf, errBuf bytes.Buffer |
| 443 | validator := NewValidator(&outBuf, &errBuf, ValidatorOptions{}) |
| 444 | |
| 445 | result := validator.validateFile("/nonexistent/file.sql") |
| 446 | |
| 447 | if result.Error == nil { |
| 448 | t.Error("Expected error for non-existent file") |
| 449 | } |
| 450 | |
| 451 | if result.Valid { |
| 452 | t.Error("Expected valid=false for non-existent file") |
| 453 | } |
| 454 | |
| 455 | if !strings.Contains(result.Error.Error(), "file access validation failed") { |
| 456 | t.Errorf("Expected 'file access validation failed' error, got: %v", result.Error) |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | // TestValidator_PermissionDenied tests handling of permission-denied files |
| 461 | func TestValidator_PermissionDenied(t *testing.T) { |
nothing calls this directly
no test coverage detected